uistoryboardsegue

Xcode, where to assign the segue identifier

空扰寡人 提交于 2019-11-26 02:58:07
问题 Pardon me for beginner\'s question. I know I can switch to another screen (ViewController) like this self.performSegueWithIdentifier (\"SecondViewController\", sender: self) but I can\'t seem to find where to assign my 2nd screen the id, I just find Storyboard ID, is that it? I\'ve already tried, only received a crash with the following error: Receiver () has no segue with identifier \'SecondViewController\' Any idea? thanks 回答1: Segue Identifier is not the same as storyboard ID , storyboard

Passing Data between View Controllers in Swift

北慕城南 提交于 2019-11-26 00:38:42
问题 I am trying to convert an app from Objective-C to Swift but I can\'t find how to pass data between views using Swift. My Objective-C code is UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@\"Main\" bundle:nil]; AnsViewController *ansViewController; ansViewController = [storyBoard instantiateViewControllerWithIdentifier:@\"ansView\"]; ansViewController.num = theNum; [self presentViewController:ansViewController animated:YES completion:nil]; What that is doing is it basically takes