【发布时间】:2011-12-25 08:37:58
【问题描述】:
我正在成功使用 Storyboard。一个屏幕不是“空的”,它有一个 NotifierViewController 类。
这个类有一个 .h,.m 和 XIB 文件。该应用程序运行良好。
现在我需要在 XIB 文件中添加一个按钮来将此视图链接回我的情节提要。现在,我必须停止并重新启动应用才能看到主视图。
所以在 IB 中,我在 .h 和 .m 文件中创建了一个 UIButton 和一个 IBAction。但是我的操作代码没有运行。我只是黑屏。
我的 Storyboard 中的“初始视图控制器”视图具有类 ViewController(仅 .h 和 .m 文件)
怎么了?
#import "NotifierViewController.h"
#import "ViewController.h"
- (IBAction)home:(id)sender {
NSLog(@"Button was tapped");
// init & alloc - Replace with your custom view controllers initialization method (if applicabale)
ViewController *viewController = [[ViewController alloc] init];
[viewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:viewController animated:YES completion:NULL];
[ViewController release];
}
【问题讨论】:
标签: cocoa-touch xib storyboard