文章内的图片点击后需要单独显示出来,而且还需要支持横屏显示,也仅有这个界面支持横屏显示。
1.添加支持的方向
General—>Deployment info—>Device Orientation
2.创建继承UINavigationController的子类并添加如下方法:
- (BOOL)shouldAutorotate
{
return self.topViewController.shouldAutorotate;
}
- (NSUInteger)supportedInterfaceOrientations
{
return self.topViewController.supportedInterfaceOrientations;
}
3.在不需要支持横屏显示的界面添加如下方法(iOS6以上):
-(BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
5.由于横竖屏的切换,界面需要重新绘画,可以在如下方法中进行(iOS6以上):
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;