i know this is going to be a vague question, but please give a thought to this...
I am developing a book reader on ipad and it has many functionalities like highlight, notes etc. and all these functions are woking well. But the problem comes only when i try to rotate my device after implementing any function.. The app is geting struck(or hanged) after changing itz orientation....
Can anyone tell me why a app usually gets hanged???? Give a thought to this please. Your inputs will help me go a long way.....
Thanks
The problem might be with your control frame settings.
If your application support portrait mode alone means code as follows,
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
else
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return YES;
}
and change the control frame accordingly.
Related
I've looked everywhere, Yet I cant find a solution for this annoying rotation issue in iOS 6.
for some reason, I cant get the rotation methods in iOS 6 to work. they are not even called.
for example:
if I want to keep a view in portrait mode in iOS 5, I use:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
I learned that the new method in iOS 6 should be:
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}
I've also try to add:
-(BOOL)shouldAutorotate
{
return NO;
}
but it dosent work at all.
please help!
If you have all that it should be as simple as setting the supported orientations in the Info.plist as well as in your controllers. You can do this through the Summary tab on your project target.
I have a code in each view controller:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
also I changed supported device orientations in a plist.
What else could it be?
P.S. As I checked — notifications about rotation not sends anymore. Probably there is a conflict with some framework...
Check this out Why won't my UIViewController rotate with the device?
And one remark, do not modify device orientations from plist, there is another way , select project , then Summary tab and then in Supported Device Orientations choose that you need. This way will automatically edit your plist.
In my sencha-tpuch / phonegap app on iOS I want my app not to change orientation with the device its used on. how could I suppress orientation change in sencha-touch or what would I override exactly?
thnx!
You dont need to edit any code. All you need to do is go to your configuration files and specify orientations you want to support. By default all 4 orientations are supported, you have to edit it to support orientations you want. Rebuild the application and Go.
The entry should be in one of the following files:
phonegap.plist/application.plist/config.xml
Also check this link.
With only Sencha Touch, as it cannot force browser not to change orientation, it is NOT possible to remove orientation change. See this link.
In your phonegap xcode project find the file MainViewController.m in there find the function
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
And return yes for supported orientations.
Although I know how to handle screen orientation in an iPhone application. Is there possibly a way we can ignore it?
Either by means of some code or may be setting it somewhere. For example in Android we can ignore screen orientation by making few changes. Is there some way in iPhone too?
If you don't implement or handle all the orientation then it should be oke:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
You app will only support portrait mode.
you can stop screen orientation by returning interfaceOrientation == UIInterfaceOrientationPortrait on shouldAutoRotateToInterfaceOrientation
Edited to be technically correct.
I want my iPad app to stop rotation as you rotate the iPad. I want to stop rotate every view.
Any ideas help?
if you want stop rotation for whole app then simply in app info.plist file changed Supported interface orientations ,Initial interface orientation property to portrait or landscape depends on you
In iOS6 shouldAutorotateToInterfaceOrientation has be deprecated. Override both supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation instead.
Please see
Just check the auto-resizing property of your view controller.
(Fixed syntax error)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationPortrait)
return YES;
return NO;
}
In My Project's info.plist I have deleted some key on the iPad Supported interface orientations like the following image (I have only given support for the portrait orientation)
The main idea of global controllable rotation lock is to write UIViewController category containing lock mechanism for every view controller.
You simply need to modify supportedInterfaceOrientations method globally
- (NSUInteger)supportedInterfaceOrientations
{
return __orientation;
}
Here __orientation is the static variable which can be set via category method.
The full realization of the category is presented here
Please update your projectname.plist like this. Supported interface orientations have only one object "Portrait (bottom home button)"
I strongly advise against stop rotation on iPad because supporting rotation is a must on the iPad. This is because the iPad does not have a normal way in which it will be held unlike the iPhone, which is normally held in portrait view (AKA Vertical). So you have to leave the choice to the user to eventually lock the orientation
The HIG do not actually state this as a requirement, but as a recommendation but there are many app that was rejected by this issue.
By the way if you want to this for a limit number of view controller you should implement:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(interfaceOrientation == UIInterfaceOrientationPortrait){
return YES;
}
}