2012-05-04 8 views
0

私のiPhoneシミュレータ(Xcode 4.2)で空のテーブルを表示しようとしていますが、どういうわけか何がわかりません私は間違いをした。今は普通の白いページだけを示しています。実際にはそれは私にテーブルを表示する必要があります。注エラーメッセージ "アプリケーションの起動時にルートビューコントローラが必要です"

  • HomepwnerAppDelegate:私はビッグオタクランチ者ガイド「iPhoneプログラミング」、第10章

    の指示に従うよだから、今、私は私のHomepwnerアプリの4つのファイルを持っています.M

  • HomepwnerAppDelegate.h
  • ItemsViewController.h
  • ItemsViewController.m

「ItemsViewController」は、UITableViewControllerのサブクラスです。

ItemsViewController.h

# import <UIKit/UIKit.h> 

    @interface ItemsViewController : UITableViewController 

@end 

ItemsViewController.m

isn't filled with interesting stuff right now 

HomepwnerAppDelegate.h

# import <UIKit/UIKit.h> 

@class ItemsViewController; 

@interface HomepwnerAppDelegate : NSObject <UIApplicationDelegate> { 
    UIWindow *window; 
    ItemsViewController *itemsViewController; } 


@property (nonatomic, retain) IBOutlet UIWindow *window; 

@end 

HomepwnerAppDelegate.m

#import "HomepwnerAppDelegate.h" 
#import "ItemsViewController.h" 

@implementation HomepwnerAppDelegate 

@synthesize window = _window; 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    //Create a ItemsViewController 
    itemsViewController = [[ItemsViewController alloc] init]; 

    //Place ItemsViewController's table view in the window hierarchy 
    [window addSubview:[itemsViewController view]]; 
    [window makeKeyAndVisible]; 
    return YES; 
} 

@end

コンソールは言う:Homepwner [2400:207]アプリケーションが

は、私が知っているアプリケーションの起動の最後にルートビューコントローラを有することが期待されます"didFinishLaunchingWithOptions:"メソッドでリンクされている同じエラーメッセージを持つ他のスレッドが既に存在していますが、それらは非常に多くのソリューションを提供して以来、私はかなり混乱しています。もう何も...私はちょうど私は何か間違ったと宣言した。 どのように問題を解決するには?

+0

この質問は役に立ちますか? http://stackoverflow.com/questions/7520971/applications-are-expected-to-have-a-root-view-controller-at-the-end-of-applicati – trojanfoe

+0

私はすでに最初のものを試しました、それdoesn助けてください。たぶん、私はすべての答えを試す時間を投資する必要があります。 – Kirinriki

+0

ええ、それは確かにここですでに答えられています。 – trojanfoe

答えて

0

私はそれが価値があるのか​​分からないけど、あなたは、これは私がこの問題を持っていたとき、私はそれを解決しました方法です

self.window.rootViewController = itemsViewController; 

を試してみました。

+0

あなたの答えに感謝します!しかし、それをどこに置くのか?私はそれを** didFinishLaunchingWithOptions **に入れましたが、今は何も起こりません...私はそれを取得しません...このダムの質問に申し訳ありません... 私は空のテーブルビューを表示する理由はそれは "チュートリアル"の一部であり、私はこの部分が継続的に働くために必要なことを知っています。私が言ったように:私はチュートリアルで説明したのと同じ方法ですべてをやった。私は学習過程にいるので、何が問題なのか分かりません。 – Kirinriki

関連する問題