Skip to content

Commit

Permalink
Merge branch '20140401-dev-stable' into feature-20141030-3-way-im-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Raymond committed Oct 30, 2014
2 parents dcc44de + 05b7cb3 commit cc4c1b1
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions Samples/OpenPeerSampleApp/OpenPeerSampleApp/ChatViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ - (void)viewDidLoad
{
[super viewDidLoad];

self.keyboardIsHidden = NO;
self.keyboardIsHidden = YES;
self.isFirstRun = YES;
//[self.chatTableView setTranslatesAutoresizingMaskIntoConstraints:NO];
//[self.typingMessageView setTranslatesAutoresizingMaskIntoConstraints:NO];
Expand All @@ -136,10 +136,7 @@ - (void)viewDidLoad
self.tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
self.tapGesture.numberOfTapsRequired = 1;

if (!self.keyboardIsHidden)
{
[self.messageTextbox becomeFirstResponder];
}
[self.messageTextbox becomeFirstResponder];

NSError *error;
if (![self.fetchedResultsController performFetch:&error])
Expand Down Expand Up @@ -341,12 +338,15 @@ -(void)resetKeyboard:(NSNotification *)notification
-(void)keyboardWillShow:(NSNotification *)notification
{
[self.chatTableView addGestureRecognizer:self.tapGesture];
self.keyboardIsHidden = NO;
[self.delegate prepareForKeyboard:[notification userInfo] showKeyboard:YES];
[self setFramesSizesForUserInfo:[notification userInfo]];

if ([[[self fetchedResultsController] fetchedObjects] count] > 0)
[self.chatTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[[[self fetchedResultsController] fetchedObjects] count] - 1 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
if (self.keyboardIsHidden)
{
self.keyboardIsHidden = NO;
[self.delegate prepareForKeyboard:[notification userInfo] showKeyboard:YES];
[self setFramesSizesForUserInfo:[notification userInfo]];

if ([[[self fetchedResultsController] fetchedObjects] count] > 0)
[self.chatTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[[[self fetchedResultsController] fetchedObjects] count] - 1 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
}

-(void)keyboardWillHide:(NSNotification *)notification
Expand Down Expand Up @@ -764,6 +764,7 @@ - (void) refreshMessages
exit(-1); // Fail
}

[self.view bringSubviewToFront:self.chatTableView];
[self.chatTableView reloadData];
}
@end
Expand Down

0 comments on commit cc4c1b1

Please sign in to comment.