【发布时间】:2012-03-04 02:58:04
【问题描述】:
我将如何使用 xcode 4.2 和情节提要通过代码更改视图? 单击动态表视图单元格后,我正在尝试更改视图。 由于它是动态的,我不能只将它与 segue 联系起来......
我已尝试按照有关 Stack Overflow 的另一篇文章的建议使用此代码进行更改,但它不起作用:
UIViewController *alertView = [self.storyboard instantiateViewControllerWithIdentifier:@"alertView"];
[self.navigationController pushViewController:alertView animated:YES];
这是我的代码的sn-p,希望对您有所帮助!
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row==0){
UIViewController *alertView = [self.storyboard instantiateViewControllerWithIdentifier:@"alertView"];
[self.navigationController pushViewController:alertView animated:YES];
NSLog(@"This code is being called...");
}
【问题讨论】:
-
“由于它是动态的,我不能只将它与 segue 链接......”嗯,是的,你可以 - 只需 ctrl-drag 从原型到下一个视图控制器。你试过这个但没有运气吗?
标签: iphone objective-c ios ipad