简体   繁体   English

iPhone SDK简单问题

[英]iPhone SDK Simple Question

Is it possible to add a UIActivityIndicatorView to the left side of a UITableViewCell? 是否可以在UITableViewCell的左侧添加UIActivityIndi​​catorView? We're already using the right side of a UITableViewCell for a disclosure indicator. 我们已经在使用UITableViewCell的右侧作为公开指示器。

Thanks. 谢谢。

Sure. 当然。 Just instantiate a UIActivityIndicatorView, give it a .frame that sets it where you want it, add it as a subview of cell.contentView, and call startAnimating . 只需实例化一个UIActivityIndi​​catorView,为其提供一个.frame即可将其设置在所需位置,将其添加为cell.contentView的子视图,然后调用startAnimating

UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] 
    initWithFrame:CGRectMake(0,0,20,20)]; //or whatever--this will put it in the top left corner of the cell
[cell.contentView addSubview:spinner]
[spinner startAnimating];
[spinner release];

If you create a custom cell, you can do anything you want. 如果创建自定义单元,则可以执行任何操作。 But this document here from Apple should give you all you need whether just adding subviews to a regular old UITableViewCell or creating your own. 但是,Apple提供的这份文档应该为您提供所有所需的条件,无论是将子视图添加到常规的旧UITableViewCell还是创建自己的子视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM