开发者

Page controller and UITableView causes small lag

I have a page controller which consists of five table views. When swiping between these table views, there is a short lag. Is this normal or could it be caused by some bad code?

I have uploaded a short video demonstrating the issue.

[Video] UITableView with UIPageController causes a lag

EDIT: It is as if it helps removing cell.detailTextLabel.text would this make sense?

This is where I set the detail label:

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat: @"'kl.' HH:mm"];
NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
[dateFormat setTimeZone:gmt];
NSString *dateFormatted = [dateFormat stringFromDate:[thisEntry objectForKey:@"date"]];

if(![[thisEntry objectForKey:@"weekDay"] isEqualToString:@"Ikke programsat"]) {
   cell.detailTex开发者_如何学编程tLabel.text = [NSString stringWithFormat:@"%@ %@", [thisEntry objectForKey:@"scene"], dateFormatted];
}

[dateFormat release];


I would guess the issue most likely has to do with the image on the top of each page. The table in each page seems to only contain lightweight cells that contain only text. So, each table should render fairly quickly. It's the image on top that may be taking some time to render. Whenever I encounter lag in any of my apps, the first thing I look at are graphical assets. Images can take some time to render, depending on the size and resolution of the image. If it is the image, then you need to consider the possibility of using some caching. The documentation on UIImage and UIImageView contains some helpful information.

Also, I would suggest you run some tests using Shark in order to pin down exactly what part of your code is causing the performance hit. It might not be the image at all but rather some piece of code that is querying for a piece of data that it is having to wait on for some reason.

Hope this helped. Good Luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜