사용자의 게시물이 포함 된 tableview가 있습니다. 각 게시물에는 사진, 사용자 이름 및 게시물 자체가 있습니다. 새로 고침 컨트롤의 동작은 Parse의 데이터로 테이블을 다시로드하는 것입니다. 내가 새로 고침 할 때 극단적 인 지연을 제외하고는 모든 것이 완벽하게 작동합니다. 나는 그것이 각 세포 또는 다른 것의 그림 때문에 그것이 었는지 나는 모른다. 왜 이런 일이 일어날 지에 대한 아이디어가 있다면 알려주십시오. 나는 누군가가 그것을 필요로한다면 코드를 게시 할 것이다.UIRefreshControl lagging
-(void)viewDidLoad {
refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(retrieveFromParse) forControlEvents:UIControlEventValueChanged];
refreshControl.backgroundColor = [UIColor whiteColor];
refreshControl.tintColor = [UIColor colorWithRed:0.3878 green:0.5686 blue:1.0 alpha:0.9];
[userPostsTable addSubview:refreshControl];
}
-(void) retrieveFromParse {
PFQuery *quoteQuery = [PFQuery queryWithClassName:@"Quotes"];
quoteQuery.cachePolicy = kPFCachePolicyCacheThenNetwork;
[quoteQuery orderByDescending:@"createdAt"];
[quoteQuery getFirstObjectInBackgroundWithBlock:^(PFObject *object, NSError *error) {
if (!error) {
NSString *category = [object objectForKey:@"Category"];
if (category == nil) {
quoteLabel.font = [UIFont fontWithName:@"Helvetica Neue Light Italic" size:15];
}
else {
quoteLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:15];
}
quoteString = [object objectForKey:@"quoteContent"];
quoteLabel.text = quoteString;
quoteIdString = object.objectId;
[refreshControl endRefreshing];
}
else {
[refreshControl endRefreshing];
}
}];
PFQuery *userPostsQuery = [PFQuery queryWithClassName:@"userPosts"];
userPostsQuery.cachePolicy = kPFCachePolicyCacheThenNetwork;
[userPostsQuery setLimit:300];
[userPostsQuery whereKey:@"quoteObjectId" matchesKey:@"objectId" inQuery:quoteQuery];
if (segmentedControl.selectedSegmentIndex == 0) {
[userPostsQuery orderByDescending:@"createdAt"];
}
else {
[userPostsQuery orderByDescending:@"likeCount"];
}
[userPostsQuery findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
userPostsArray = [[NSArray alloc] initWithArray:objects];
[userPostsTable reloadData];
[refreshControl endRefreshing];
}
else {
[refreshControl endRefreshing];
}
}];
}
는 아무 말도 할 수 없다. –
죄송합니다. – bpomp87
완료 블록 내의 코드가 주 스레드 또는 백그라운드 스레드에서 호출 되었습니까? 비록 내가 너무 많은 구문 분석에 익숙하지 않아도 그 문서가 주 스레드에서 호출되는지 아닌지를 말할 수는 없지만 문제가 될 수 있습니다. – Mike