【发布时间】:2016-02-06 09:42:29
【问题描述】:
我正在学习 iOS 开发,我在互联网上找到了一个应用程序源示例。
我正在尝试重写它并将其用于选项卡式布局,并从示例应用程序复制AppDelegate.m 后,出现以下错误:
'FirstViewController' 的不可见 @interface 声明选择器分配
在下面一行:
FirstViewController *FirstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
这是我完整的 AppDelegate:
#import "AppDelegate.h"
#import "FirstViewController.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
FirstViewController *FirstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:FirstViewController];
self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
@end
我的FirstViewController.m 文件中出现同样的错误(selector InithWithNibName:bundle)
MyViewController* MyController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
我不知道这个错误是什么意思。
【问题讨论】:
-
能否包含 FirstViewController 的代码?
标签: ios objective-c