开发者

Selecting UITableViewCell programmatically?

I want to make a now playing button for my radio application. So would like to know how can I select a row programmatically I thought of calling didSelectRow开发者_StackOverflow社区AtIndexPath method but apparently we can't call it.


didSelectRowAtIndexPath is the method from delegate and it's called when you touch (select) the row in UITableView

Use below method to selct a row on your UITableView instance.

- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition

See Sample code.

[myTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionMiddle];


There is tableView method like [tableView selectRowAtIndexPath:anIndexPathObject animated:BOOL-Flag]; .By calling this method you can select the row programmatically. But you also need to create an index path object.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜