触摸表格视图单元格didSelectRowAtIndexPath或prepareforSegue后的第一种方法? [英] First method after touching a table view cell didSelectRowAtIndexPath or prepareforSegue?
问题描述
我已经根据类型设计了各种书籍的表格视图.如果用户触摸单元格,则会对需要书籍项目的新视图控制器执行搜索.我已经在
I have designed a table view of various books in sections according to their type.If user touches on cell ,a segue is performed to a new view controller which needs a book item.I have initialised this book in
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
方法.但是先触摸后的方法不首先调用,下面的方法首先调用!!!
method.But after a touched is method is not called first,the following method is called first!!!!
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
触摸表格视图单元格后调用的第一个方法是什么??
What is is the first method called after touching a table view cell....?
推荐答案
我认为您不能将segue链接到当前视图控制器的视图,而不是链接到单元格.在这种情况下,单击单元格
I think you have to link segue not with cell but with view of the current view controller. In such case when you click on cell
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
将不会被调用.然后在
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
您可以手动执行segue:
you can manualy perform segue:
[self performSegueWithIdentifier:@"MySequeIdentifier" sender:self];
这篇关于触摸表格视图单元格didSelectRowAtIndexPath或prepareforSegue后的第一种方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!