2012-03-16 5 views
2
たタイプのオブジェクトを見つけません

secondViewController.h:がプロパティビューsecondViewController

#import <UIKit/UIKit.h> 

@interface secondViewController : UIViewController 

@end 

viewController.m:

#import "ViewController.h" 
#import "secondViewController.h" 

@interface ViewController() 

@end 

@implementation ViewController 
@synthesize secondViewController; 

- (IBAction)switchView:(id)sender{ 
    [self.view addSubview:secondViewController.view atIndex:0]; 
} 

は、プロパティビューのトラブル何種類secondViewController のないオブジェクトを見つけませんか?

答えて

0
-(IBAction)switchView:(id)sender{ 
secondViewController *second = [[secondViewController alloc] init]; 
[self.view addSubview:second.view atIndex:0]; 
} 

また、その@synthesize secondViewController;を削除します。

+0

私はxibファイルを作成します。initWithNibName – leoliu

関連する問題