XIB loads in iOS 4 but doesn't load in iOS 5 - iphone

I created an app in Xcode 4.1 and now i upgraded it to 4.2 so i could use the iPhone 5 simulator.
I have an app that uses a tab bar to loads 3 views. They load correctly in iPhone 4 but in iPhone 5 simulator that doesn´t happen. I´m able to see my xib (with no content) that i load initially, but there are no tabs to choose from.
Apple made some changes in the projects in Xcode 4.2. Now they have storyboards which i don´t have because i created the app in Xcode 4.1. Anyone knows a work-around this?
The only code i think it may be usefull..
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[window addSubview:montraViewController.view];
[self.window makeKeyAndVisible];
return YES;
}

I was loading the view in viewDidAppear, that method was triggered when the view appeared in iOS 4 but in iOS 5 that didn´t happen. So i changed my "load controls" to the method viewDidLoad and they loaded correctly. Don´t take this has a bug, because it´s more probable to be bad programing.

Related

Xcode5 build universal app for iPhone in iPad store

I found a problem with my build, looks like Xcode5 changed this in comparing to Xcode4.
before, in Xcode4: I choose to build "universal" app and my app with iPhone size is scaled on iPad, can be found both in iPhone and iPad store.
now, in Xcode5: if I choose "universal", my app with iPhone size is no longer scaled on iPad, but keeps the original size while leaving the whole right part empty. If I choose "iPhone", it is scaled on iPad, but can no longer be found in iPad store.
I noticed UIDeviceFamily is removed from Info.plist in Xcode5
what I want is simply the same build result with Xcode5 for my app as with Xcode4. Anyone has any idea about it?
Here's my code to initiate the root view in
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
DialoguesVC* dvc = [[DialoguesVC alloc] init];
HomeVC* hvc = [[HomeVC alloc] initWithRootViewController:dvc];
[self.window setRootViewController:hvc];
HomeVC is a UINavigationViewController.
Xcode 5 requires that a separate storyboard for iPhone and iPad is defined in the target for your universal app. You can however select the same one if you like. Here's how to do it:
In the Project Navigator on the left, select the bug blue bar at the top with your Project Name in it.
On the right, select your target from the drop down menu. This is where you define if your app is iPhone, iPad or Universal. In your case, select Universal (under Deployment Info).
You should now see two tabs in the same section: iPhone and iPad. Switch between them to define allowed orientations, Status Bar Style and - most importantly - select which Storyboard you're using for each device.
That should do the trick, and when run on an iPad, it should now load the iPhone storyboard as Xcode 4 would have done.
This may not look as attractive as you would hope - in which case you can copy your iPhone Storyboard and make changes specifically for iPad. I've explained how to do this here: http://pinkstone.co.uk/how-to-convert-your-iphone-storyboard-into-an-ipad-storyboard/

iOS 7 Default image overlapped by status bar in multi-tasking view

My app is compiled against iOS 6 SDK (haven't gotten the time to upgrade to iOS 7 SDK). So I just noticed that the Default image is overlapped by the status bar. This seems to happen only in the "multi-tasking" view but not when resuming my app from background for some reason.
See this image:
I don't think many people will notice this at all.
However, as far as I know you could possibly disable the Statusbar when the app gets in backround.
To do this just use this method in the delegate:
- (void)applicationWillResignActive:(UIApplication *)application {
//code to disable statusbar
}
In the applicationDidBecomeActive method you could enable the statusbar again.
- (void)applicationDidBecomeActive:(UIApplication *)application {
//code to enable the statusbar
}
Furthermore you can take a look at this previous asked question: Status bar won't disappear
If you got any questions feel free to ask!
edgesForExtendedLayout does the trick for iOS 7. However, if you build the app across iOS 7 SDK and deploy it in iOS 6, the navigation bar appears translucent and the views go beneath it. So, to fix it for both iOS 7 as well as for iOS 6 do this:
self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
if ([self respondsToSelector:#selector(edgesForExtendedLayout)])
self.edgesForExtendedLayout = UIRectEdgeNone; // iOS 7

orientation is not getting fix ipad 6?

Hi I have developed an application in ios 4, now I am building it on ios 6 but the orientation is not working. I am using splitview for iPad.
I had the same issue before.
I fixed it by setting the rootview controller of window as UISplitView.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self.window setRootViewController:viewController];
}
Where UISplitViewController *viewController;
check my answers on this link my friend.
Device orientation handling in iOS 6 during view load?
if you are not getting then do tell me..
Let me know it is working or not...
Happy Coding!!!

iOS4 to iOS5, first view of tabBar app is not responding to touches

I have a tabBar App, with 5 tabs. The application was built in previous version of Xcode for iOS4.3. When I run this app from Xcode 4.3 (after changing the base SDK to 'Latest iOS'), in iPhone4.3 simulator the App runs fine. But when I run this App, in iPhone 5.0 simulator
App loads fine i.e. my first screen from the first View controller is loaded correctly. But no touches are recognised by the screen (on tableView, navigationBar and toolBar)
If I select another 'tab', the touch is recognised and touches in the other views loaded from other tabs work fine. Now if I go back to the first view, it works fine.
The tabBarControllers, navigationControllers and the viewControllers I created in Interface Builder and have following code in
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
[self.window addSubview:self.tabBarController.view];
[self.window addSubview:[self.navigationController view]];
[self.window addSubview:self.toolBar];
[self.window makeKeyAndVisible];
return YES;
}
I am missing something that iOS5 needs, but I just can't figure it out. If anyone else had similar problem, it would be great if you could share it and if you have a solution... that would be fantastic!
Just found my mistake...
I have bit more code in application:DidFinishLaunchingWithOptions where I am initialising other properties of the App and further down in the code, I have repeated the code
[self.window addSubview:self.tabBarController.view];
This must be creating another layer on top of my view and causing the view to not respond.
(knew I would find the answer on stack overflow :).... so as soon I post the problem here, I see my mistake)

App shows white screen on startup after upgrading to iOS 4.2

For the past few weeks I have been working on an app that uses a SoundManager class that I found via the comments of this blog post:
http://www.gehacktes.net/2009/03/iphone-programming-part-6-multiple-sounds-with-openal/
The link to the SoundManager and tester app is provided in the comments by David Evans. I am not allowed to provide a second link so I'll mention the name of ZIP file he links to:
SoundTester.zip
I was very happy with this code, until iOS 4.2 was released. After updating my iPad and Xcode correspondingly, my apps that use the SoundManager class only show the navigation bar with it's title. The rest of the screen is white. It's not iPad specific behavior. I have seen the same on an iPhone4 and an iPhone 3G that upgraded to iOS 4.2.
When running the apps in the simulator, I get the same results. The problem is that I get no error messages in the console window and no build and compile errors at all. Very frustrating and very hard to fix for an iPhone developer that started using the iPhone SDK only months ago.
Does anyone have a clue what could have gone broken and how to fix it? Any help is appreciated!
Somebody please shoot me...
Just found the problem, with the help from a piece of code I had written down from the iPhone Developer's Cookbook.
The problem was not the SoundManager (which still works fine, fortunately!) but in the application:didFinishLaunchingWithOptions: method in the App Delegate class.
Here is the code that causes the problem in iOS 4.2 but still works in iOS 3.2:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Create a Navigation Controller on the fly.
// Use the View Controller as root view controller.
viewController.title = #"ThreeSounds";
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:viewController];
nav.navigationBar.barStyle = UIBarStyleBlack;
// Add the view controller's view to the window and display.
[window addSubview:nav.view];
[nav release];
[window makeKeyAndVisible];
return YES;
}
The solution: remove the line that says: [nav release].
For some reason, releasing the navigation controller was not a problem in iOS 3.2.
In iOS 4.2 is makes the screen go white.
I found out that this method was the problem because it was the last method that was executed. That, in turn, I found out by adding this piece of code to every class in my project:
-(BOOL) respondsToSelector:(SEL)aSelector {
printf("SELECTOR: %s\n", [NSStringFromSelector(aSelector) UTF8String]);
return [super respondsToSelector:aSelector];
}
This piece of code logs all the methods that get called.
I used the following code in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
if (!window)
{
[self release];
return 0;
}
This method caused white screen when I launched my app. It was OK in 3.2 / 4.0 SDK. In SDK 4.3 it is causing the problem. Just comment or remove this code if you have it.
I had same problem. The problem was duplicated UIWindow.