2011-04-07 10 views
1

그래서 간단한 app.I 할 nib files.I 변경할 펜촉 컨트롤을 firstController 첫 번째로드 할 펜촉하지만 그것은 단지 빈 화면을 신발.Ios 빈 화면

MyAppDelegate.h

#import <UIKit/UIKit.h> 

@class IpadAppViewController,FirstPageViewController; 

@interface IpadAppAppDelegate : NSObject <UIApplicationDelegate> { 
    UIWindow *window; 
    IpadAppViewController *viewController; 
    IBOutlet FirstPageViewController *firstController; 
} 

@property (nonatomic, retain) IBOutlet UIWindow *window; 
@property (nonatomic, retain) IBOutlet IpadAppViewController *viewController; 
@property (nonatomic, retain) IBOutlet FirstPageViewController *firstController; 

@end 

MyAppDelegate.m

// 
// IpadAppAppDelegate.m 
// IpadApp 
// 
// Created by Stefan Andrei on 3/24/11. 
// Copyright 2011 IMC. All rights reserved. 
// 

#import "IpadAppAppDelegate.h" 
#import "IpadAppViewController.h" 
#import "FirstPageViewController.h" 

@implementation IpadAppAppDelegate 

@synthesize window; 
@synthesize viewController; 
@synthesize firstController; 


#pragma mark - 
#pragma mark Application lifecycle 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  

    // Override point for customization after app launch. 
    [self.window addSubview:firstController.view]; 
    [self.window makeKeyAndVisible]; 
    return YES; 
} 


- (void)applicationWillResignActive:(UIApplication *)application { 
    /* 
    Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 
    Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 
    */ 
} 


- (void)applicationDidBecomeActive:(UIApplication *)application { 
    /* 
    Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 
    */ 
} 


- (void)applicationWillTerminate:(UIApplication *)application { 
    /* 
    Called when the application is about to terminate. 
    See also applicationDidEnterBackground:. 
    */ 
} 


#pragma mark - 
#pragma mark Memory management 

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { 
    /* 
    Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later. 
    */ 
} 


- (void)dealloc { 
    [viewController release]; 
    [window release]; 
    [super dealloc]; 
} 


@end 
+0

firstController는 어떻게 초기화합니까? – SVD

+0

나는 그렇지 않았다. 어떻게이 일을 할 수 있습니까? – flaviusilaghi

답변

1

하기 전에 : 여기 내 코드 [self.window의 addSubview를 : firstController.view], 당신은 무엇을해야

self.firstController = [[[FirstPageViewController alloc] initWithNibName:nil bundle:nil] autorelease]; 

.xib와 함께 FirstPageViewController를 만든 경우에는 충분해야합니다. 그렇지 않으면 ma y는 initWithNibName에서 펜촉 이름을 전달해야합니다.

편집 : 추가 된 autorelease - firstController 속성이 이미 보유됩니다.

+0

작동합니다. 감사합니다. – flaviusilaghi

관련 문제