0
시작시 iPhone 앱에 콘텐츠를 표시 할 수 없습니다. 무엇이 잘못 되었습니까? 보기 컨트롤러가 loadView
를 구현하지 않는 한iPhone - 앱이 항상 빈 흰색 화면으로 시작됩니까?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
HomeViewController *t = [[HomeViewController alloc] init];
[self.window addSubview:t.view];
[self.window makeKeyAndVisible];
// I tried the following in case the problem is my
//view controller but nothing shows up at all
UISegmentedControl *t = [[UISegmentedControl alloc] init];
[self.window addSubview:t];
[self.window makeKeyAndVisible];
}
실제로 내 문제는 내 펜촉 이름 "HomeViewController.m.xib"에 ".m"을 그대로두고 이름을 바꿨으며 문제가 해결되었습니다. – aryaxt
nib 파일이 완전히 동일하면 initWithNibName이 필요하지 않습니다. viewcontroller로서의 이름 – aryaxt
@aryaxt :이 경우 NIB 이름을 지정할 필요가 없다는 것은 사실입니다. 그러나 IMO는'UIViewController'의 지정된 이니셜 라이저이기 때문에'initWithNibName : bundle :'(둘 다'nil'을 사용하여) 사용해야합니다. –