すべてのコードを貼り付けずにこれを説明する方法は本当にわかりませんが、試してみてください。.hsと.msが正確であると「仮定」すると、.xibが正しく設定されていないように感じますが、そこからコードを実際に貼り付けることはできません。代わりに、ファイルを圧縮してソースコードをアップロードしました。(十分に勇気がある場合は、ここにあります:http: //bit.ly/ZtDkGi)ビルドは成功していますが、アプリの起動後、エミュレーターの画面が真っ暗になっています。
基本的に、appDelegateオブジェクトを手動で追加する必要がありました。クラスを適切なクラスに設定しましたが、それでもプルしません。誰かが親切に助けてくれるなら、それは素晴らしいことです。
これが私のTest_TableViewAppDelegate.hです
#import <UIKit/UIKit.h>
@interface Test_TableViewAppDelegate : NSObject <UIApplicationDelegate>
{
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navController;
@end
これが私の新しいTest_TableViewAppDelegate.mです
#import "Test_TableViewAppDelegate.h"
@implementation Test_TableViewAppDelegate
@synthesize window=_window;
@synthesize navController=_navController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
//self.window.backgroundColor = [UIColor whiteColor];
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
window.backgroundColor = [UIColor greenColor];
self.window = window;
UIViewController *fvc = [[UIViewController alloc] init];
UIViewController *rootController = [[UIViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
UINavigationController *nc = [[UINavigationController alloc]initWithRootViewController:rootController];
//UINavigationController *nc = [[UINavigationController alloc]initWithRootViewController:fvc];
self.navController = nc;
//[self.window addSubview: nc.view];
//[self.window makeKeyAndVisible];
self.window.rootViewController = self.navController;
[self.window makeKeyAndVisible];
return YES;
}
RootViewController.h
#import <UIKit/UIKit.h>
@interface RootViewController : UITableViewController {
NSMutableArray *petsArray;
}
@end
RootViewController.m
#import "RootViewController.h"
@interface RootViewController ()
@end
@implementation RootViewController
最後になりましたが、main.m(これも問題になる可能性があると思います)
#import "Test_TableViewAppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([Test_TableViewAppDelegate class]));
}
}
前もって感謝します。よろしくお願いします:D