AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
[manager GET:[NSString stringWithFormat:@"%@%@",TIC_URL,@"list_messages.php"] parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject)
{
NSLog(@"responseObject %@",responseObject);
if (![[responseObject valueForKey:@"status"] isEqualToString:@"0"]) {
marrChat = [responseObject valueForKey:@"data"];
[self.tblChat reloadData];
if (marrChat.count > 0)
{
[self.tblChat scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:marrChat.count-1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:YES];
}
}
failure:^(AFHTTPRequestOperation *operation, NSError *error)
{
NSLog(@"Error %@",error);
[CommonFunctions showNoNetworkError];
HideHUD;
}];
答案 0 :(得分:0)
将[self.tblChat reloadData];
写入主队列。
dispatch_sync(dispatch_get_main_queue(), ^{
[self.tblChat reloadData];
});
答案 1 :(得分:0)
试试这个:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
[UIView performWithoutAnimation:^{
[cell layoutIfNeeded];
}];
}