开发者

iPhone UIViewController Lag

开发者 https://www.devze.com 2023-03-13 21:04 出处:网络
I have a \'detail\' page where I am displaying info for a club. The page is a UIViewController and consists of buttons and labels to acheive this look (like small g开发者_高级运维rouped tables). When

I have a 'detail' page where I am displaying info for a club. The page is a UIViewController and consists of buttons and labels to acheive this look (like small g开发者_高级运维rouped tables). When I load this page on a device, it lags a bit, more than any other view in my app.

I assume its because I have quite a few objects on the view controller. Does anyone have any suggestions on how to reduce this lag? Or how to achieve the look the 3 smaller tables like this(grouped) in a different way?

Thanks.

SCREENSHOT:

iPhone UIViewController Lag


You could try making custom tablecells and use UITableView instead?


You could just make the view a UITableView using UITableViewStyleGrouped style, and then programmatically create the cells for each row. Overriding

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

gets you your titles like "Meeting Information" and "Contact", and overriding

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

gets you correct sizing on each table cell. If the text in "General Information" is not going to be a constant size, you can use the

-sizeWithFont::(UIFont *)font

method of NSString in your heightForRowAtIndexPath implementation.


The issue is not likely your interface design. UI drawing is pretty snappy usually. The things that slow it down are accessing data. If you have a large data set you are searching you might look at ways to speed that up.

0

精彩评论

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

关注公众号