처음 응용 프로그램을 시작할 때 페이지를 표시하는 방법을 알고 싶습니다.이 코드를 가져 와서 많은 코드를 얻을 수 있지만 제 경우에는 작동하지 않습니다. DidFinishLaunching 메서드에서이 코드를 사용합니다.처음 응용 프로그램 시작시 UIViewController를 표시하는 방법?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES],@"firstLaunch",nil]];
//If First Launch
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) {
//Show help view
UIScrollView_PagingViewController *detailViewController = [[UIScrollView_PagingViewController alloc] initWithNibName:@"UIScrollView_PagingViewController" bundle:nil];
//detailViewController.firstString = firstString;
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
else {
NSError *error = nil;
NSString *username = [[NSUserDefaults standardUserDefaults] objectForKey:@"username"];
NSString *str = [SFHFKeychainUtils getPasswordForUsername:username andServiceName:@"mybibleapp" error:&error];
NSLog(@"previous user");
NSLog(@"%@", str);
if (!error && nil != str)
{
ParallelReadViewController *detailViewController = [[ParallelReadViewController alloc] initWithNibName:@"ParallelReadViewController" bundle:nil];
//detailViewController.firstString = firstString;
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
else
{
RootViewController *detailViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
//detailViewController.firstString = firstString;
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
}
하지만이 코드를 실행하면 아무 것도 표시되지 않는 빈 흰색 화면이 표시됩니다.
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES],@"firstLaunch",nil]];
//If First Launch
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) {
//Show help view
UIScrollView_PagingViewController *detailViewController = [[UIScrollView_PagingViewController alloc] initWithNibName:@"UIScrollView_PagingViewController" bundle:nil];
//detailViewController.firstString = firstString;
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
else {
은 내가 더 고마워 행운을 빌어 내가 위의 code.?.please에서 만든 실수가 좀 도와 없다 나누었다 시작 발사 UIScrollView_PagingViewController에 대해 위의 코드를 삽입. 미리 감사드립니다.