InputView.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // InputView.h
  3. // TableViewDemo
  4. //
  5. // Created by BenGang on 14-7-21.
  6. // Copyright (c) 2014年 BenGang. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "UIViewExt.h"
  10. @class InputView;
  11. @protocol InputViewDelegate <NSObject>
  12. @optional
  13. - (void)keyboardWillShow:(InputView *)inputView keyboardHeight:(CGFloat)keyboardHeight animationDuration:(NSTimeInterval)duration animationCurve:(UIViewAnimationCurve)animationCurve;
  14. - (void)keyboardWillHide:(InputView *)inputView keyboardHeight:(CGFloat)keyboardHeight animationDuration:(NSTimeInterval)duration animationCurve:(UIViewAnimationCurve)animationCurve;
  15. - (void)recordButtonDidClick:(UIButton *)button;
  16. - (void)addButtonDidClick:(UIButton *)button;
  17. - (void)publishButtonDidClick:(UIButton *)button;
  18. - (void)textViewHeightDidChange:(CGFloat)height;
  19. @end
  20. @interface InputView : UIView <UITextViewDelegate>
  21. @property (retain, nonatomic) IBOutlet UIImageView *images;
  22. @property (weak, nonatomic) IBOutlet UIButton *recordButton;
  23. @property (weak, nonatomic) IBOutlet UIButton *addButton;
  24. @property (weak, nonatomic) IBOutlet UIButton *publishButton;
  25. @property (weak, nonatomic) IBOutlet UITextView *inputTextView;
  26. @property (weak, nonatomic) id<InputViewDelegate> delegate;
  27. - (IBAction)recordButtonClick:(id)sender;
  28. - (IBAction)addButtonClick:(id)sender;
  29. - (IBAction)publishButtonClick:(id)sender;
  30. - (void)resetInputView;
  31. @end
  32. /*
  33. - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
  34. {
  35. [self.inputView.inputTextView resignFirstResponder];
  36. self.backView.hidden = YES;
  37. [UIView animateWithDuration:0.1 animations:^{
  38. self.inputView.bottom = self.view.height;
  39. }];
  40. }
  41. #pragma mark InputViewDelegate
  42. - (void)keyboardWillShow:(InputView *)inputView keyboardHeight:(CGFloat)keyboardHeight animationDuration:(NSTimeInterval)duration
  43. {
  44. self.backView.hidden = YES;
  45. self.keyboardHeight = keyboardHeight;
  46. [UIView animateWithDuration:duration animations:^{
  47. self.inputView.bottom = self.view.height - keyboardHeight;
  48. }];
  49. }
  50. - (void)keyboardWillHide:(InputView *)inputView keyboardHeight:(CGFloat)keyboardHeight animationDuration:(NSTimeInterval)duration
  51. {
  52. self.keyboardHeight = 0;
  53. self.backView.hidden = YES;
  54. [UIView animateWithDuration:duration animations:^{
  55. self.inputView.bottom = self.view.height;
  56. }];
  57. if ([self.inputView.inputTextView.text isEqualToString: @""]) {
  58. self.inputView.inputTextView.textColor = ColorWithRGB(70, 70, 70);
  59. self.currentSelectedReply.forUserId = [NSString stringWithFormat:@"%d",self.currentPost.userId];
  60. louzhu = YES;
  61. }
  62. }
  63. */