My Application supports all orientation but in few cases i want to lock the screen in
portrait/landscape mode.
In my Application i have two kind of pdf document.
one is in portrait document and other is landscape document .
i want to open portrait document in portrait view only, and landscape document in
landscape view only.
i want to do like this: if my application is open in landscape view and i click on the
portrait document so it must rotate in portrait view and same like this for landscape if
my application is open in portrait view and when i click on the landscape document it
must be rotate or it must open the document in landscape only.
hope i make you guys clear pardon my english hope you understand what i want please
need your help .
Thank you in advance
here is my some code :
- (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);
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…