简体   繁体   中英

prepareForSegue:sender: is never called

I am following a tutorial for building a simple iOS application .

I am currently on the Displaying Information in the Detail Scene chapter.

At the end it says I should now be able to run the application. However, when I do run it and I click on a row in the master uitableview, it simply highlights blue but does not segue to the detail uitableview.

So I put an NSLog in the prepareForSegue:sender: method and it is never called.

Also, I do not remember telling Xcode (neither in the storyboard nor in any code) to segue when a row is pressed.

Did I miss a part of the tutorial or did the tutorial leave something out? Or did I just do a foolish mistake somewhere? Please help me figure out how to activate the segue.

Thanks in advance!

make sure these.

1) [self performSegueWithIdentifier:@"SegueName" sender:self];

do this in below method-

(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

2) set delegate of first tabel view.

Hope it helps.

1 . Add segue from master table view to detail table view , just ctrl drag and select style as per your need

在此处输入图片说明

2 . set segue identifier

在此处输入图片说明

3 in did select use performSegueWithIdentifier to navigate

- (void)tableView:(UITableView *)tbView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
 [self performSegueWithIdentifier:@"Navigate" sender:self];
 }

转到情节提要,将单元格与目标视图链接,仅链接Ctrl拖动,然后在弹出菜单中选择“推”,然后选择链接并设置您的标识符(使用教程记忆的标识符),该方法将在处调用。内部补全事件,将调用您的方法

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