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
A
Antwort
0
Schreiben Sie die [self.tblChat reloadData];
in die Hauptwarteschlange.
dispatch_sync(dispatch_get_main_queue(), ^{
[self.tblChat reloadData];
});
0
Dieses versuchen:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
[UIView performWithoutAnimation:^{
[cell layoutIfNeeded];
}];
}
Nachladedaten im Hauptthread –
dispatch_async (dispatch_get_main_queue()^{ [self.tblChat reload]; }); funktioniert nicht ........ – ragu
Sind Sie sicher, dass Ihre Antwort von api Erfolg ist kein Fehler. –