ios - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 的写法

写法1:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
    if ([segue.identifier isEqualToString:@"ProjectDetailsSegue"]) {
        ProjectDetailsViewController *detailsVC = segue.destinationViewController;
        detailsVC.idString = sender;
    }

写法2:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
    if ([[segue destinationViewController] isKindOfClass:[EZWifiConfigViewController class]]) {
        ((EZWifiConfigViewController *)[segue destinationViewController]).ssid = self.nameTextField.text;
        ((EZWifiConfigViewController *)[segue destinationViewController]).password = self.passwordTextField.text;
    }
}

 

posted on 2016-08-09 09:06  codemaker313  阅读(831)  评论(0编辑  收藏  举报

导航