【发布时间】:2013-12-16 05:22:46
【问题描述】:
我的应用程序支持所有方向,但在少数情况下我想锁定屏幕
纵向/横向模式。
在我的应用程序中,我有两种 pdf 文档。
一个是纵向文档,另一个是横向文档。
我只想在纵向视图中打开纵向文档,并在横向视图中打开文档
仅限风景。
我想这样做:如果我的应用程序以横向视图打开并且我点击了
纵向文档,因此它必须在纵向视图中旋转,如果是横向视图,则与此相同
我的应用程序以纵向视图打开,当我单击横向文档时它
必须旋转,否则只能横向打开文档。
希望我让你们清楚原谅我的英语希望你们明白我想要什么
需要你的帮助。
提前谢谢你
这是我的一些代码:
- (void)viewDidLoad
{
[super viewDidLoad];
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait || orientation ==
UIInterfaceOrientationPortraitUpsideDown) {
NSLog(@"Portrait");
if ([orientationObject isEqualToString:@"p"]) {
//If the document is portrait
pdfScrollViewFrame = CGRectMake(-0.0, -80.0, 770.0, 1085.0);
}
else{
// If the document is landscape
pdfScrollViewFrame = CGRectMake(-0.0, -40.0, 770.0, 1130.0);
}
}
else{
NSLog(@"Landscape");
if ([orientationObject isEqualToString:@"p"]) {
//If the document is portrait
pdfScrollViewFrame = CGRectMake(65.0, -80.0, 620.0, 1110.0);
}
else{
//if the document is landscape
pdfScrollViewFrame = CGRectMake(0.0, -40.0, 740.0, 1070.0);
}
}
【问题讨论】:
-
这和
xcode有什么关系?
标签: ios objective-c orientation lockscreen landscape-portrait