Fix invalid scroll in chat room view

This commit is contained in:
Yann Diorcet 2012-07-18 15:29:42 +02:00
parent c9558e8f82
commit ddfe400b81
3 changed files with 13 additions and 14 deletions

View file

@ -91,7 +91,11 @@
}
// Scroll to unread
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:animated];
if(index >= 0) {
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0]
atScrollPosition:UITableViewScrollPositionMiddle
animated:animated];
}
}
#pragma mark - Property Functions

View file

@ -303,10 +303,14 @@ static UICompositeViewDescription *compositeDescription = nil;
// Scroll
int lastSection = [tableController.tableView numberOfSections] -1;
int lastRow = [tableController.tableView numberOfRowsInSection:lastSection] - 1;
[tableController.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:lastRow inSection:lastSection]
atScrollPosition:UITableViewScrollPositionBottom
animated:TRUE];
if(lastSection >= 0) {
int lastRow = [tableController.tableView numberOfRowsInSection:lastSection] - 1;
if(lastRow >=0) {
[tableController.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:lastRow inSection:lastSection]
atScrollPosition:UITableViewScrollPositionBottom
animated:TRUE];
}
}
[UIView commitAnimations];
}

View file

@ -637,7 +637,6 @@
<string key="42.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="8.CustomClassName">TPKeyboardAvoidingTableView</string>
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<real value="2" key="9.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
@ -734,14 +733,6 @@
<string key="minorKey">./Classes/ChatRoomViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">TPKeyboardAvoidingTableView</string>
<string key="superclassName">UITableView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/TPKeyboardAvoidingTableView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIToggleButton</string>
<string key="superclassName">UIButton</string>