2013-02-07 14 views
0

我有mainView中的按钮,当我点击主视图按钮(id 1)其操作调用nextView [secondview有tableView] tableView单元格第一行选中或突出显示state.its状态设置为选中。点击UIButton并调用它的动作下一个查看表单元格行选择状态?

-(IBAction)btnOneClicked:(id)sender 
{ 
    SecondView *nextView = [[SecondView alloc] initWithNibName:@"SecondView" bundle:nil]; 
    [self.navigationController pushViewController:SecondView animated:YES]; 
    NSIndexPath* selectedCellIndexPath= [NSIndexPath indexPathForRow:0 inSection:0]; 
    [nextView tableView:nextView.firstTable didSelectRowAtIndexPath:selectedCellIndexPath]; 
} 

你可以看看我的按钮动作方法。我尝试了很多选择,但没有成功。请帮助。

回答

2

tableView:didSelectRowAtIndex:实际上是您选择行时调用的委托方法。

以选择该行,你需要调用

[nextView.firstTable selectRowAtIndexPath:selectedCellIndexPath animated:YES scrollPosition:UITableViewScrollPositionTop] 
+0

现在它的工作很好,谢谢... – Ravindhiran

0

试试下面的代码

[button_refresh addTarget:<instance where you want to implement the method> action:@selector(refreshContent:) forControlEvents:UIControlEventTouchUpInside]; 

希望它会帮助你。

相关问题