2012-01-20 2 views
0

Inferis/ViewDeck 라이브러리 here의 기능 예제를 따르려고합니다. 그러나 루트보기 컨트롤러가로드되지만 내 로그인보기로 전달되지 않습니다. View Deck Choices View 대신 Login View를 사용하고 있습니다.RootViewController가 NIB에로드되지 않음

APAppDelegate.h

#import <UIKit/UIKit.h> 
@class LoginController; 

@interface APAppDelegate : UIResponder <UIApplicationDelegate> 

@property (strong, nonatomic) UIWindow *window; 

@end 

APAppDelegate.m

#import "APAppDelegate.h" 
#import "RootViewController.h" 

@implementation APAppDelegate 

@synthesize window = _window; 


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    // Override point for customization after application launch. 
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; 
    RootViewController *rootController = (RootViewController *)[mainStoryboard instantiateViewControllerWithIdentifier:@"RootViewController"]; 
    self.window.rootViewController = rootController;//[[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil]; 
    [self.window makeKeyAndVisible]; 
    return YES; 
} 

이 나는 ​​스토리 보드를 사용하고 있기 때문에 광산에 대한 MainStoryboard을 사용했다 그는 XIB를 사용합니다. appdelegate에서 initwithNibName을 시도함으로써 RootViewController가 존재하지 않는다는 오류가 발생했습니다.

RootViewController.h

#import <UIKit/UIKit.h> 

@interface RootViewController : UIViewController 
{ 

} 

@property (nonatomic, retain) IBOutlet UIView *loginView; 
@property (nonatomic, retain) UINavigationController *navController; 

@end 

RootViewController.m

#import "RootViewController.h" 
#import "IIViewDeckController.h" 
#import "LoginController.h" 
#import "SideMenuView.h" 
#import "APCustomerViewController.h" 

@implementation RootViewController 
@synthesize loginView = _loginView; 
@synthesize navController = _navController; 
- (void)viewDidLoad 
{ 
    NSLog(@"RootViewController viewDidLoad"); 
    [super viewDidLoad]; 

    // Override point for customization after application launch. 
    LoginController *loginController = [[LoginController alloc] initWithNibName:@"LoginController" bundle:nil]; 

    self.navController = [[UINavigationController alloc] initWithRootViewController:loginController]; 
    self.navController.navigationBar.tintColor = [UIColor darkGrayColor]; 

    self.navController.view.frame = self.loginView.bounds; 
    [self.loginView addSubview:self.navController.view]; 
    NSLog(@"End RootViewController viewDidLoad"); 
} 

LoginController.h

#import <UIKit/UIKit.h> 
@class KeychainItemWrapper; 
@class DataClass; 

@interface LoginController : UITableViewController <UITextFieldDelegate> 
{ 
    IBOutlet UITextField *userField; 
    IBOutlet UITextField *passwordField; 
    IBOutlet UISwitch *saveLogin; 
    UIActivityIndicatorView *activitySpinner; 
    KeychainItemWrapper *keychain; 
    DataClass *dataObj; 

    id delegate; 
} 

@property (nonatomic, retain) IBOutlet UITextField *userField; 
@property (nonatomic, retain) IBOutlet UITextField *passwordField; 
@property (nonatomic, retain) IBOutlet UISwitch *saveLogin; 
@property (nonatomic, retain) id delegate; 

@end 

LoginController.m

- (void)viewDidLoad 
{ 
    NSLog(@"LoginController viewDidLoad"); 
    [super viewDidLoad]; 
    [userField setDelegate:self]; 
    [passwordField setDelegate:self]; 
    TextFieldDelegate *myDelegate = [[TextFieldDelegate alloc] init]; 
    [self setDelegate:myDelegate]; 
    //set the delegate's currentViewController property so that we can add a subview to this View. 


    activitySpinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; 
    activitySpinner.frame = CGRectMake(0.0, 0.0, 40.0, 40.0); 
    activitySpinner.center = self.view.center; 
    [self.view addSubview:activitySpinner]; 

    keychain = [[KeychainItemWrapper alloc] initWithIdentifier:@"APLogin" accessGroup:nil]; 
    [userField setText:[keychain objectForKey:(__bridge id)kSecAttrAccount]]; 
    [passwordField setText:[keychain objectForKey:(__bridge id)kSecValueData]]; 

    if ([userField text] != @"" && [passwordField text] != @"") { 
     [saveLogin setOn:YES]; 
    } 

    dataObj = [DataClass getInstance]; 

    // Do any additional setup after loading the view from its nib. 
} 
,691,363 (210)

로그 파일

GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov 3 21:59:02 UTC 2011) 
Copyright 2004 Free Software Foundation, Inc. 
GDB is free software, covered by the GNU General Public License, and you are 
welcome to change it and/or distribute copies of it under certain conditions. 
Type "show copying" to see the conditions. 
There is absolutely no warranty for GDB. Type "show warranty" for details. 
This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all 
Attaching to process 18487. 
2012-01-20 11:56:11.586 Appointment-Plus[18487:f803] RootViewController viewDidLoad 
2012-01-20 11:56:11.589 Appointment-Plus[18487:f803] End RootViewController viewDidLoad 

나는 스토리 보드 펜촉 클래스 파일과 같은 내 모든 클래스 이름을 가지고있다. 보시다시피, RootViewController viewDidLoad는 완전히 실행 중이지만 LoginController는 전혀 실행되지 않습니다. RootViewController에서 LoginController를 실행하려고합니다.

궁극적 인 목표는 일부 페이지에서만 슬라이드 아웃되는 페이스 북 스타일 메뉴를 얻는 것입니다. 메뉴를 사용할 페이지는 LoginController 뒤에 있습니다.

1) 사용자는 응용 프로그램을 열고에서 로그인 페이지를 2) 사용자 로그를 가져오고 페이스 북의 IOS 스타일의 메뉴 3) 사용자가 항목을 클릭 할 때 새로운 페이지로 이동 할 수 있습니다로 메인 페이지를 가져옵니다 사이드 메뉴가 없습니다.

이 모든 것을 관리하려면 RootViewController가 필요하다는 것을 알고 있어야합니다.

답변

0

라이브러리를 사용하지 않기로 결정하고 루트보기 컨트롤러를 사용하고 내 자신의 슬라이드 메뉴를 만들었습니다.

관련 문제