I am using a tableview to display a message and i used the code below
UIView *chatView = [self bubbleView:[NSString stringWithFormat:@"%@", message] from:YES];
[self.chatArray addObject:[NSDictionary dictionaryWithObjectsAndKeys:message, @"text", @"self", @"speaker", chatView, @"view", nil]];
[self.chatTableView reloadData];
[self.chatTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[self.chatArray count]-1 inSection:0]
atScrollPosition: UITableViewScrollPositionBottom
animated:YES];
And i am getting the error given below
[UITableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:]: row (0) beyond bounds (0) for section (0).'
plz help me in solving this
Seems to me that your table view does not have any rows or sections in yet. Two possibilities come to my mind.
numberOfRowsInSection
delegate and numberOfSectionsInTableView
so that they are not set to 0.tableview
has not yet finished loading the data.Do share your findings, so I might be able to help out further if needed.
Make sure your table view is getting reloaded before scrolling. because after adding the data in the array, we need to reload the data to populate the TableView cell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With