Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 对于';没有可见的@界面;导航视图控制器';声明选择器';initWithRootViewController:&x27;_Ios_Objective C - Fatal编程技术网

Ios 对于';没有可见的@界面;导航视图控制器';声明选择器';initWithRootViewController:&x27;

Ios 对于';没有可见的@界面;导航视图控制器';声明选择器';initWithRootViewController:&x27;,ios,objective-c,Ios,Objective C,我下面的代码所有内容都在我的Xcode项目的AppDelegate.m文件中 #import "AppDelegate.h" #import "NavigationViewController.h" #import "HubViewController.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWit

我下面的代码所有内容都在我的Xcode项目的
AppDelegate.m
文件中

    #import "AppDelegate.h"
    #import "NavigationViewController.h"
    #import "HubViewController.h"

    @implementation AppDelegate

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.rootViewController = [[NavigationViewController alloc] initWithRootViewController:[[HubViewController alloc] init]];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
    }

    @end

我在
“self.window.rootViewController”行中不断收到一个错误,该行声明“NavigationViewController没有可见的@interface”,声明选择器“initWithRootViewController:”
。它还在错误日志中将其声明为1ARC问题1。(自动参考计数问题)。对于这个问题有什么已知的解决方案吗?

我猜您刚刚开始使用objective-c和iOS开发。您可以创建自己的NavigationViewController类,但您可能打算使用-这是一个预封装的容器视图控制器,用于处理推/弹出式导航。它通常充当应用程序中的根视图控制器

背景色:

您将看到导航控制器的视图将占用整个窗口。因此,您应该设置:

self.window.rootViewController.view.backgroundColor = [UIColor whiteColor];
电弧错误:

对于ARC错误,您需要发布更多信息

iTunes U:


我建议您从iTunes U下载并观看iOS斯坦福大学iOS Univserity iOS编程课程。这是一个很棒的介绍,而且是免费的

谢谢你的回复!