我有以下代碼:黑屏更改視圖4,5
MapViewController.h
#import <UIKit/UIKit.h>
#import "PlaceViewController.h"
@interface MapViewController : UIViewController <MKMapViewDelegate> {
IBOutlet PlaceViewController *placeview;
}
- (IBAction)passPlace:(id)sender;
MapViewController.m
@synthesize placeview;
- (IBAction)passPlace:(id)sender{
self.placeview = [[[PlaceViewController alloc] initWithNibName:nil bundle:nil] autorelease];
[self presentViewController:placeview animated:YES completion:nil];
}
PlaceViewController.h
@interface PlaceViewController : UIViewController{
}
- (IBAction)back:(id)sender;
@end
PlaceViewController.m
@implementation PlaceViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
NSLog(@"Change!!!!!");
[super viewDidLoad];
// Do any additional setup after loading the view.
}
而且情節提要:
http://img685.imageshack.us/img685/1233/screengy.png
我不知道什麼我做錯了,因爲當我改變觀點,PlaceViewController是一個帶有藍色狀態欄的黑屏。
任何人都可以幫到我嗎?由於
如果你正在使用'storyboard',爲什麼你需要給'initWithNibName'。你可以從'MapViewController'鏈接到你的'storyboard'中的'PlaceViewController' – arthankamal