I am creating a chat application in iOS, but I have some problems displaying a UITableView of all messages. I want the table view to be scrolled to the bottom of the download so that users can see the latest messages when they open the application.
To do this, I added this code to my function, updating the data:
NSIndexPath* ipath = [NSIndexPath indexPathForRow: [self.messageOnTimeline numberOfRowsInSection:0]-1 inSection: 0]; [self.messageOnTimeline scrollToRowAtIndexPath: ipath atScrollPosition: UITableViewScrollPositionTop animated: YES];
This worked fine until I added a title to the table. I added the following code, and now when I download the application, it does not scroll down.
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 30)]; return view; }
Does anyone know why?
Many thanks for your help
ios header uitableview scroll scrollto
Spearfisher
source share