iOS 5 and iOS 6 UITabBarController MoreNavigationViewController rotation - ios

My project is based on UITabBarController with multiple UINavigationContollers. I am adjusting app to support rotation in iOS 6. I have made subclass of UITabBarController so that I can block rotation. That works perfect. But there is problem with MoreNavigationViewController. On iOS 5 it rotates and on iOS 6 it does not. My goal is to block it. I have to support all orientations (in Info.plist) because I am using MPMoviePlayerViewController which sould adjust to rotation. Is there a way to subclass MoreNavigationViewController?

If anyone will have the same situation this is what I have done to solve it:
Info.plist support all orientations
In custom subclass of UITabBarController I have added this method
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
Works both iOS 5 and iOS 6.

Related

UISearchBar embedded in UIBarButtonItems (IT IS iPad document!)

I had UISearchBar embedded in UIBarButtonItems for a years in the iPad storyboard. Now when I turn Use Size Classes on, the storyboard (which is using exclusively for iPad), throw the compilation time error:
UISearchBar embedded in UIBarButtonItems (Only available in iPad
documents)
Is there any way to let XCode know that the storyboard is using with iPad only!?
This was a bug with Xcode. Apple fixed the bug in Xcode 8.2. Now you can use UISearchBar in UIToolbar in adaptive storyboards.

Ios app strange rotation behaviour after iOS 8 SDK update

I've been developing an iPad app which was working fine until i updated my Xcode to version 6 and my iPad to iOS 8.The problem i am encountering now is that when i change the orientation of my iPad i can catch the event but the views do not rotate accordingly.To be specific in my iPad with iOS 7 app rotates itself size of the views stay the same; for example if i start the app in portrait mode and change rotation to landscape there is a space on the right side of the uiview.In my iPad with IOS 8 views do not even rotate itself and stay the same all the time.I'm not using auto layout and app used to work like charm before IOS 8 SDK release.I need your help on finding articles and cause of the problems.Thanks in advance
probably the cause of problem is this line but i need to have this because otherwise my app won't release uiwebview from memory.
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
self.view.window.rootViewController=self;
}
Rotation handling has changed in iOS 8. Methods such as willRotateToInterfaceOrientation:duration: and didRotateToInterfaceOrientation: are now deprecated and replaced by viewWillTransitionToSize:withTransitionCoordinator:. Depending on how you're handling rotations in your app, you may have to make changes in your code to adapt to the new methods. Check chapter "Handling view rotation" in the UIViewController reference docs

Touch controls working for iOS 7,6,5... but not for iOS 8

I developed a OpenGL ES game several years ago and works well until now: I have downloaded Xcode 6 and iOS 8 in my iPad 3, and touch control (touchesBegan, touchesMoved, touchesEnded) only detect a square of 768x768 points, instead of 1024x768.
A margin of 256 points (1024-768) not respond to pulsations.
The game is in landscape mode.
It seems as if the touch control think that iPad is in portrait mode instead of landscape mode. Visually it is in landscape.
Looks like a bug in iOS 8.
Finally figured this out if anyone is still dealing with this - it looks like iOS 8 causes some problems when adding a UIView directly to the window in the app delegate. I had to create a UIViewController, add the UIView to that, and then make it the root view controller.

Hiding the Status Bar for an iPhone app running on iPad

My iPhone app requires that the status bar be hidden at all times. This is generally easy to do, and it works if I only run the app on an iPhone. However, if I run the app on an iPad, the status bar still appears at the top of the content. So, how do I make sure the status bar is hidden no matter device my iPhone-only app is running on? I'm currently doing the following in my code:
Calling this method for each view controller(I actually created a category on UIViewController that implements this automatically for any VC, but it's basically the same as writing it in each vc file):
-(BOOL)prefersStatusBarHidden{
return YES;
}
I also set "status bar is initially hidden" to YES and "View controller-based status bar appearance" to NO in Info.plist. I've also tried detecting which device is being used and calling
[UIApplication sharedApplication]setSetStatusBarHidden:YES]
in the AppDelegate, but no luck there either. So, I believe I've tried just about everything that one would think to try.
It seems this was introduced into iOS 7.1 and affects non-retina iPads running iPhone applications with retina graphics.
No solution for developers. I think Apple will have to patch this one...
Problem devices:
iPad 2
iPad Mini (non-retina).
Problem does not exist in iOS 7.0 and status bar issues can be fixed for 7.0 with the other solutions posted.
Update for September 2014 - iOS 8:
This bug is fixed for iOS 8!!!!!
Add this code.
- (BOOL)prefersStatusBarHidden{
return YES;}
Add an property in YourViewController as
#property BOOL statusBarHidden;
and then in ViewDidLoad add the following lines of code
[self prefersStatusBarHidden];
[self performSelector:#selector(setNeedsStatusBarAppearanceUpdate)];
self.statusBarHidden = YES;
Then add an method in YourViewController
- (BOOL)prefersStatusBarHidden{
return YES;}
and also don't forgot to add the #import <UIKit/UIKit.h> in your code it works great for IOS6.1 & 7.0 :)

Developing fullscreen 4inch app in xcode [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
How do I support the taller iPhone 5 screen size?
How to make my app 4inch-ready? My app in iOS6GM simulator looks not 4inch-sized.
Is there any option in xcode to use all 4 inches?
Some users have reported that it was fixed after adding the startup image Default-568h#2x.png (see below).
For updating to iPhone5 I did the following:
Autorotation is changing in iOS 6. In iOS 6, the shouldAutorotateToInterfaceOrientation: method of UIViewController is deprecated. In its place, you should use the supportedInterfaceOrientationsForWindow: and shouldAutorotate methods. Thus, I added these new methods (and kept the old for iOS 5 compatibility):
-(BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
Then I fixed the autolayout for views that needed it.
Copied images from the simulator for startup view and views for the
iTunes store into PhotoShop and exported them as png files.
The name of the default image is: Default-568h#2x.png the size is
640 x 1136 and the screen size 320 x 568.
I have dropped backward compatibility for iOS 4. The reason is that
this new Xcode does not support armv6 code any more. Thus, all
devices that I am able to support now (running armv7) can be upgraded
to iOS 5.
That was all but just remember to test the autorotation in iOS 5 and iOS 6 because of the changes in rotation.
Before iPhone 5 release, I just use
#define kViewHeight 460.f // or 480.f if you don't have a status bar
#define kViewWidth 320.f
But now, I would like to use
#define kViewHeight CGRectGetHeight([UIScreen mainScreen].applicationFrame)
#define kViewWidth CGRectGetWidth([UIScreen mainScreen].applicationFrame)
instead.
But I'm not sure whether it is a good solution. As you see, you would dispatch CGRectGetHeight([UIScreen mainScreen].applicationFrame) every where you use kViewHeight. I've tried to use
extern float kViewHeight; // in .h
float kViewHeight = CGRectGetHeight([UIScreen mainScreen].applicationFrame) // in .m
but failed with a compile error.
Though it works well, I think there must be a better workaround. ;)

Resources