Compare commits
13 Commits
master
...
iOS6_suppo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
309329cc0c | ||
|
|
92d13ae31e | ||
|
|
351118b20e | ||
|
|
08bcc96f08 | ||
|
|
420c643f86 | ||
|
|
03ac5832c9 | ||
|
|
5d5d6a410b | ||
|
|
68ec26479f | ||
|
|
bf4a2a7525 | ||
|
|
666eace95b | ||
|
|
3a7e8b13dc | ||
|
|
eb485f2184 | ||
|
|
b81cfae779 |
@ -13,5 +13,5 @@ Pod::Spec.new do |s|
|
|||||||
s.frameworks = 'QuartzCore'
|
s.frameworks = 'QuartzCore'
|
||||||
s.requires_arc = true
|
s.requires_arc = true
|
||||||
|
|
||||||
s.dependency 'JSQSystemSoundPlayer'
|
s.dependency 'JSQSystemSoundPlayer', '1.5.2'
|
||||||
end
|
end
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
@property (assign, nonatomic) CGFloat previousTextViewContentHeight;
|
@property (assign, nonatomic) CGFloat previousTextViewContentHeight;
|
||||||
@property (assign, nonatomic) BOOL isUserScrolling;
|
@property (assign, nonatomic) BOOL isUserScrolling;
|
||||||
|
@property (assign, nonatomic) BOOL isObserving;
|
||||||
|
|
||||||
- (void)setup;
|
- (void)setup;
|
||||||
|
|
||||||
@ -54,6 +55,10 @@
|
|||||||
((UIScrollView *)self.view).scrollEnabled = NO;
|
((UIScrollView *)self.view).scrollEnabled = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) {
|
||||||
|
self.automaticallyAdjustsScrollViewInsets = NO;
|
||||||
|
}
|
||||||
|
|
||||||
_isUserScrolling = NO;
|
_isUserScrolling = NO;
|
||||||
|
|
||||||
JSMessageInputViewStyle inputViewStyle = [self.delegate inputViewStyle];
|
JSMessageInputViewStyle inputViewStyle = [self.delegate inputViewStyle];
|
||||||
@ -113,26 +118,31 @@
|
|||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
[self setup];
|
[self setup];
|
||||||
[[JSBubbleView appearance] setFont:[UIFont systemFontOfSize:16.0f]];
|
[[JSBubbleView appearance] setFont:[UIFont systemFontOfSize:16.0f]];
|
||||||
|
self.isObserving = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewWillAppear:(BOOL)animated
|
- (void)viewWillAppear:(BOOL)animated
|
||||||
{
|
{
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
if (!self.isObserving) {
|
||||||
selector:@selector(handleWillShowKeyboardNotification:)
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
name:UIKeyboardWillShowNotification
|
selector:@selector(handleWillShowKeyboardNotification:)
|
||||||
object:nil];
|
name:UIKeyboardWillShowNotification
|
||||||
|
object:nil];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
||||||
selector:@selector(handleWillHideKeyboardNotification:)
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
name:UIKeyboardWillHideNotification
|
selector:@selector(handleWillHideKeyboardNotification:)
|
||||||
object:nil];
|
name:UIKeyboardWillHideNotification
|
||||||
|
object:nil];
|
||||||
[self.messageInputView.textView addObserver:self
|
|
||||||
forKeyPath:@"contentSize"
|
[self.messageInputView.textView addObserver:self
|
||||||
options:NSKeyValueObservingOptionNew
|
forKeyPath:@"contentSize"
|
||||||
context:nil];
|
options:NSKeyValueObservingOptionNew
|
||||||
|
context:nil];
|
||||||
|
|
||||||
|
self.isObserving = YES;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewWillDisappear:(BOOL)animated
|
- (void)viewWillDisappear:(BOOL)animated
|
||||||
@ -141,11 +151,15 @@
|
|||||||
|
|
||||||
[self.messageInputView resignFirstResponder];
|
[self.messageInputView resignFirstResponder];
|
||||||
[self setEditing:NO animated:YES];
|
[self setEditing:NO animated:YES];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
|
if (self.isObserving) {
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
|
||||||
[self.messageInputView.textView removeObserver:self forKeyPath:@"contentSize"];
|
|
||||||
|
[self.messageInputView.textView removeObserver:self forKeyPath:@"contentSize"];
|
||||||
|
|
||||||
|
self.isObserving = NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didReceiveMemoryWarning
|
- (void)didReceiveMemoryWarning
|
||||||
@ -233,7 +247,7 @@
|
|||||||
if ([self.delegate respondsToSelector:@selector(customCellIdentifierForRowAtIndexPath:)]) {
|
if ([self.delegate respondsToSelector:@selector(customCellIdentifierForRowAtIndexPath:)]) {
|
||||||
CellIdentifier = [self.delegate customCellIdentifierForRowAtIndexPath:indexPath];
|
CellIdentifier = [self.delegate customCellIdentifierForRowAtIndexPath:indexPath];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CellIdentifier) {
|
if (!CellIdentifier) {
|
||||||
CellIdentifier = [NSString stringWithFormat:@"JSMessageCell_%d_%d_%d_%d", (int)type, displayTimestamp, avatar != nil, [message sender] != nil];
|
CellIdentifier = [NSString stringWithFormat:@"JSMessageCell_%d_%d_%d_%d", (int)type, displayTimestamp, avatar != nil, [message sender] != nil];
|
||||||
}
|
}
|
||||||
@ -282,6 +296,7 @@
|
|||||||
- (void)finishSend
|
- (void)finishSend
|
||||||
{
|
{
|
||||||
[self.messageInputView.textView setText:nil];
|
[self.messageInputView.textView setText:nil];
|
||||||
|
[self.messageInputView.textView.undoManager removeAllActions];
|
||||||
[self textViewDidChange:self.messageInputView.textView];
|
[self textViewDidChange:self.messageInputView.textView];
|
||||||
[self.tableView reloadData];
|
[self.tableView reloadData];
|
||||||
}
|
}
|
||||||
@ -323,7 +338,7 @@
|
|||||||
{
|
{
|
||||||
if (self.isUserScrolling) {
|
if (self.isUserScrolling) {
|
||||||
if ([self.delegate respondsToSelector:@selector(shouldPreventScrollToBottomWhileUserScrolling)]
|
if ([self.delegate respondsToSelector:@selector(shouldPreventScrollToBottomWhileUserScrolling)]
|
||||||
&& [self.delegate shouldPreventScrollToBottomWhileUserScrolling]) {
|
&& [self.delegate shouldPreventScrollToBottomWhileUserScrolling]) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -494,9 +509,9 @@
|
|||||||
inputViewFrameY,
|
inputViewFrameY,
|
||||||
inputViewFrame.size.width,
|
inputViewFrame.size.width,
|
||||||
inputViewFrame.size.height);
|
inputViewFrame.size.height);
|
||||||
|
|
||||||
[self setTableViewInsetsWithBottomValue:self.view.frame.size.height
|
[self setTableViewInsetsWithBottomValue:self.view.frame.size.height
|
||||||
- self.messageInputView.frame.origin.y];
|
- self.messageInputView.frame.origin.y];
|
||||||
}
|
}
|
||||||
completion:nil];
|
completion:nil];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user