Run shouldAutorotateToInterfaceOrientation from another method?
how to run the following method
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientat开发者_运维知识库ion)interfaceOrientation {}
from another method? (so new factors could influence orientation)
That method doesn't cause the interface to rotate, it just decides if the device is ALLOWED to.
So if you want to change the factors you use to determine if rotating is allowed, you'll have to create an instance variable.
make your header have something like this:
@interface MyClassName : NSObject {
BOOL canLandscape;
}
In your "other" method, set that flag (canLandscape = YES;
).
In your shouldAutorotateToInterfaceOrientation:
, you can check this to help you decide
if (canLandscape) {
...dosomethinghere...
}
This method returns which orientations are allowed (Portrait, PortraitUpsideDown, LandscapeLeft and LandscapeRight). Calling this method would not do anything as your class shouldn't change the orientation dynamically.
What are you trying to achieve?
精彩评论