简体   繁体   English

启动特定的选项卡,然后以编程方式从UITableView启动特定的部分和单元格索引

[英]Launch a specific tab and then specific section and cell index from UITableView Programmatically

I used to use like tabBarController.selectedIndex = 3 if I want to change the active tab at launch for conditional reason like if I get a push notification and launch that specific view. 如果我出于条件原因想要在启动时更改活动选项卡,例如曾经收到推送通知并启动该特定视图,则曾经使用过tabBarController.selectedIndex = 3

but now the view I want to show is for example the 3rd tab and inside that view (which is a UITableView ) I want to select specific section and cell index. 但是现在我要显示的视图是第3个选项卡,并且在该视图(即UITableView )内,我想选择特定的部分和单元格索引。

If I know this index values a head of time can I programmatically lunch this view? 如果我知道该指标很有价值,那么我可以以编程方式吃午餐吗?

Thanks 谢谢

To select a cell, you'll need: 要选择一个单元格,您需要:

-(void)viewDidLoad:(BOOL)animated {
    // assuming you had the table view wired to IBOutlet myTableView
    // and that you wanted to select the first item in the first section
    [myTableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:NO scrollPosition:0];
}

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

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