简体   繁体   中英

how to scroll UITableView in iOS

I'm a beginner in iOS programming. I have a UITableView with 30 rows but simulator only shows first 10 rows. So I want this tableview can scroll. Please help me. Thanks so much.

I assume you're asking about how to scroll UITableView programmatically. You could try this method:

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

You should take a look at UITableView class reference

如果您正在使用故事板,则在启用滚动选项中选中标记,否则请使用此方法:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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