I have the following code:
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.
}
And the storyboard:
http://img685.imageshack.us/img685/1233/screengy.png
I have no idea that what I’m doing wrong because when I change view, the PlaceViewController is a black screen with a blue status bar.
Anyone can help me? Thanks
if you are using storyboard… go into the Storyboard Editor and in the Attributes Inspector, set an Identifier, let say “PlaceMap” (in picture “AddPlayer”)
change your code:
with
You can check alos, a very nice tutorial: http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1
UPD
that is for Navigation Controller
if you want modal… can you use: