iOS 8 Landscape mode not work properly an Not Rotating app - ios

i am developing app using ios8 support with portrait and Landscape mode both,
but problem is that when i try to rotate my Device to Landscape mode it cant work for me.
i test same thing in my other device iPhone 4 with ios7.1.2 it work fine but not working with ios 8.1 in iphone 4s
please give me suggestion if any one also have the same problem.
ARViewController* metaioCloudPlugin = [[ARViewController alloc] initWithNibName:#"ARViewController" bundle:nil];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.rootViewController = metaioCloudPlugin;
[self.window makeKeyAndVisible];
====
This is my AppDelegate code for main window root view.
Thanks in advance.

i fixed this issue .
Remove below line from code and its work fine now.
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
refer this link
iOS 8 - App not rotating appropriately

I was facing the same issue, while I was updating the xib base project for iOS8,
I found the solution inside your question,
thanks for asking :)
self.window.rootViewController = loginScreen;
While navigating to the screen
loginScreen = [[LoginScreen alloc] initWithNibName:#"LoginScreen" bundle:nil];
navigationController = [[UINavigationController alloc] initWithRootViewController:loginScreen];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = loginScreen;
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];

Related

Xcode App won't load view sometimes

my project runs without storyboards, so im loading my view inside AppDelegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window = window;
self.window.rootViewController = [[SYLoginController alloc] init];
[self.window makeKeyAndVisible];
return YES;
}
It used to work on iPhone 6 sim 9.3 but now, on all simulators it only shows a black screen. But on my iPhone 6 Device it works. Whereas on another iPhone 6 it also shows a black screen. Those two iPhones are literally the same 16gb iPhone 6 bought at nearly the same time.
In SYLoginControllers viewDiDLoad I'm logging the text of one of the buttons. Only on my device it prints the text, on all simulators and the other iPhone it prints (null), so i assume that the xib is not properly loaded.
SYLoginController is a UIViewController, and the related xib holds a UIView with its FilesOwner set to SYLoginController. I really can't see why it only works on this particular device. Also i tried [[SYTabBarController alloc] initWithNibName:#"SYLoginController" bundle:nil], this also does not work...
Did you tried to wrap it arround a Navigation Controller?
SYLoginController *syVC = [[SYLoginController alloc]initWithNibName:#"SYLoginController" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] syVC];
self.window.rootViewController = nav;
Also check again if Custom Class is set to SYLoginController in the XIB-File. And the View is connected to the Files Owner.

XCode 6 UIViewController not resizing to fill screen

I'm creating an app without Storyboard on XCode 6.4 and when I run the app, no matter which simulator I use, I always get a (320,480) screen.
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIViewController *vc = [[UIViewController alloc] init];
vc.view.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
return YES;
}
Ref img: http://i.stack.imgur.com/hGHmt.png
Already tryed:
vc.view.autoresizingMask =
UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
What should I do to make it fill the whole screen?
I had the same problem, You should set launch image of your app about default-568#2x.png with 640 x 1136 pixel size.
More info --> link
Also setting #2x #3x image assest will be good for you.
Add launch screen. It will be solved.
https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/chapters/AddingLaunchImagestoanAssetCatalog.html

xcode backward compatibility methods

I've a project that runs perfectly (I hope :)) on ios 6 SDK.
When I try to test it on ios 5 simulator, I've a blank view so I suppose that I've used some uncompatible methods.
How Can I discover and verify which methods doesn't works?
Or are there some problems with my xib?
EDIT:
My appDelegate code:
LoginViewController *loginViewController =
[[LoginViewController alloc] initWithNibName:"LoginViewController.xib" bundle:[NSBundle mainBundle]];
navigationController = [[UINavigationController alloc] initWithRootViewController:loginViewController];
navigationController.navigationBar.hidden = YES;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = navigationController;
if (![self connect]){}
[self.window makeKeyAndVisible];
"Apple and backward compatibility" is an oxymoron. It is not interesting to Apple if you publish apps that use older than the current iOS version, you know how hard they force developers and consumers to move on. I wouldn't bother and I would set the bottom line at 6.

application taking time while launching first time on iOS 6.X.X

application launch is taking 5-6 seconds on iOS 6.X.X versions in iPads. This works well on iOS 5.X. The default.png file remains a little longer on the screen with iOS 6.X.X.What could be wrong with loading.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIInterfaceOrientation orientation=[[UIApplication sharedApplication] statusBarOrientation];
if (orientation==UIInterfaceOrientationLandscapeLeft || orientation==UIInterfaceOrientationLandscapeRight)
{ self.viewController=[[EBHomeViewController alloc] initWithNibName:#"EBHomeViewController-LA" bundle:nil] ;
}
else if(orientation==UIInterfaceOrientationPortrait || orientation==UIInterfaceOrientationPortraitUpsideDown)
{
self.viewController=[[EBHomeViewController alloc] initWithNibName:#"EBHomeViewController-PT" bundle:nil] ;
}
navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.window.rootViewController = navController;
[self.window makeKeyAndVisible];
there is no heavy code in applicationDidFinishLaunching.It takes time when we install the app & open it for first time /restarting iPad & launching application.

ios 6 iPhone window.rootViewController crashes

My app works fine with iOS 5.1 on both iPad and iPhone. In iOS 6 app works fine on iPad but crashes in iPhone while setting the window.rootViewController = navigationViewController. I have set Exception break point which stops execution at this piece of code in application didFinishLaunchingWithOptions. I even tried adding it as [window addSubView:navigationViewController.view] but no luck. Has any one faced similar issue.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
rootViewController = [[SpringboardViewController alloc] initWithNibName:#"SpringboardViewController" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:rootViewController];
self.window.rootViewController = nav;
self.window makeKeyAndVisible];
return YES;
}
could you write an exception ?
take a look at these questions
applications expected to have a root view controller console
Applications are expected to have a root view controller at the end of application launch
Thanks for your replies guys i figured out the problem ,problem was with the application supportedInterfaceOrientationsForWindow where i was returning UIInterfaceOrientationPortrait instead of UIInterfaceOrientationMaskPortrait since app debugger was struck at self.window.rootViewController = nav, i thought problem was with this statement.
Thanks Ravindharan and Ogres.

Resources