Dar*_*Imi 1 objective-c xcode4 ios5
嗨,我现在问题与viewcontroller的方向.以下是我的.h文件.
@interface IPad_HomeViewController : UIViewController <UINavigationControllerDelegate>{
UIAlertView *alertWithYesNoButtons;
}
@property (weak, nonatomic) IBOutlet UILabel *lblStatus;
@end
Run Code Online (Sandbox Code Playgroud)
我在.m文件中实现以下方法.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return NO;
}
Run Code Online (Sandbox Code Playgroud)
然后我做了一个断点.我意识到shouldAutorotateToInterfaceOrientation完全没有被调用.不知道为什么没有被召唤.
请告诉我 谢谢
我认为这是因为您的UINavigationController处理调用.实现以下内容将其发送回viewController.
- (BOOL)shouldAutorotate
{
return [[self.viewControllers lastObject] shouldAutorotate];
}
- (NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
// pre-iOS 6 support
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3341 次 |
| 最近记录: |