0

I'm very new to storyboards and objective-c in general. Basically, I have a welcome screen with 4 buttons on it. Each button loads a new scene via the modal way. I added the 3 new screens by dragging a View Controller onto the page. I only have one View Controller file also. I added this code in to make it support Landscape only mode:

 // For iOS 5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
    return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
// For IOS 6

-(BOOL)shouldAutorotate {
    return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscapeLeft;
}

Now, for some reason only the original view controller (The one that first came with the storyboard, and not the View Controllers I dragged on) responds to this code. I'm extremely new to this and have no idea how to fix this.

I think I need to create new .h and .m view controller files for each view controller, and add that code in there. My only question is, how do I link those files to the view controllers in the Storyboard?

4

1 回答 1

2

在情节提要中,选择视图控制器,然后选择 Identity Inspector 选项卡。顶部字段标记为“类”。在该字段中输入您的自定义类的名称。

于 2013-05-22T21:59:33.087 回答