开发者

Best way to create progress bar in UITableView cell?

I need to create a progress bar for each table view cell, it has a fixed background color, say 100 pixels grey, and an orange bar covering the grey bar, showing current progress.

My idea is开发者_开发百科 to use an UIImageView or UIView(with grey background) for the background grey bar, as it is always there and does not change, then use a UIView for the orange bar(solid color) and change its width according to progress.

With my implementation, there are two views for each cell(not to mention other labels, images, just the progress bar), is there any better way for doing this?

Thanks!


The best advice in this situation is to work with the progress view indicator provided in the SDK. Are you writing in iOS or Mac OS?

There are also ways to customize the layout of the cell by getting its contentView property (a view) and mapping the progress indicator with its bounds:

[issueLoadingSpinner startAnimating];
//still some stuff downloading so add the spinner...
[issueLoadingSpinner setFrame:CGRectMake(cell.bounds.size.width-30.0f, 10.0f, 25.0f, 25.0f)];
[cell.contentView addSubview:issueLoadingSpinner];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜