I am compiling my app with iOS 6.1 SDK and deploying in a iOS7 device. The app's device is set for iPhone only.
I have a view controller that I add to a navigation controller.
self.window.rootViewController = [[UINavigationController alloc]
initWithRootViewController:
[[MyViewController alloc] init]];
When I deploy the app in iPad Mini running iOS 7, there is a strange gap shown at the top.
If I set the app's device to Universal, then the gap goes away. Is there any explanation for this? Thanks.
The few changes which you should take care of in iOS 7:-
1) Navigation Bar of iOS 7 is of dimension :- 320 X 64 while iOS 6 it is :- 320 X 44.
2) Navigation Bar Translucent Property is YES by default in iOS 7 so set it to NO, as status bar is also included in iOS 7.
Take care of these things and it would go fine.
// Sample Code of setting the navigation controller and image programatically in iOS 7
self.navigationController.navigationBar.translucent=NO;
[self.navigationController setNavigationBarHidden:NO animated:YES];
UIImage *backgrdNavImage=[UIImage imageNamed:#"abc.jpg"];
[self.navigationController.navigationBar setBackgroundImage:backgrdNavImage forBarMetrics:UIBarMetricsDefault];
Related
I am trying to cover status bar with my own view and to do that I calculcate frame for my view by doing something like that (also after rotation):
UIScreen *screen = [UIScreen mainScreen];
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
For iOS8+ (because since ios8 UIScreen is orientantion-dependant):
CGRect frame = [screen.coordinateSpace convertRect:statusBarFrame toCoordinateSpace:screen.fixedCoordinateSpace];
[self setFrame:frame];
For iOS7:
[self setFrame:statusBarFrame];
It works just fine for iOS8 and below but when building my app with Xcode 7 beta 4 and iOS 9 SDK something is wrong when starting app in landscape or upsidedown (it works fine if app starts in portrait) ...
ie. when I start the app while Upsidedown the custom uiwindow which should cover status bar will always end up at the bottom side of screen, any ideas what might be wrong?
Without additional information, the best solution would be to simply hide the status bar. If you still want the "status bar" for animation purposes or some other reason, the typical solution in this scenario is to simulate it by calling
- (UIView *)snapshotViewAfterScreenUpdates:(BOOL)afterUpdates on UIScreen
and use the returned view as the background for whatever view/window you're presenting. As of iOS 9, there's no public method that'll allow you to get the specific behavior you specified.
The Screen UI is developed for 3:2, but when I run the app in iOS Simulator for iphone 5 and above, I see there is a white patch below in the bottom of the screen. The rest of the screens are appearing correctly.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[self startup];
[window addSubview:loginViewController.view];
//For Eula
NSDictionary *eulaDict = [EULAController getEULADictionary];
if (eulaDict == nil || [ self checkForVersionChange] == TRUE) {
eulaController = [[EULAController alloc] initWithNibName:#"eula"bundle:[NSBundle mainBundle]];
//temp fix as for some reason this is showing up 20 pixels shifted upwards. if this works in your scenario then remove this adjustment
CGRect frame1 = CGRectMake(0,20,320,460);
[eulaController.view setFrame:frame1];
[window addSubview:eulaController.view];
}
[self updateVersionAndBuild];
[window makeKeyAndVisible];
}
Not sure, why its not fitting the entire screen. I didn enable athe AutoLayout option but it didnt help, as during the launch of the app, it stops for iphone 5/6.
Thanks in advance !
I guess you are missing the Default-568h#2x.png default launch image...
If so, just add one to your project and it will work.
You've hardcoded the frame to iPhone 4 size:
CGRect frame1 = CGRectMake(0,20,320,460);
You've said your using autoLayout. I'd remove this and use autoLayout constraints instead and it will scale.
I have an iPad application compatible with iOS 5.1 or higher. I'm updating the app for iOS 7.
I have this problem: I have a UINavigationController inside a UITabBarController. I want to add rightBarButtonItems. With iOS 6 or lower are seen, but with iOS 7 no. What I'm wrong?
PS: I'm forced to make app compatible with iOS 5.1 because there are some customers who are still using the first generation of iPad, so I can't use AutoLayout. I'm XIB because the project is a pretty old and I haven't to rewrite code.
Thank you!!
edit for Nikos M.
self.navigationItem.rightBarButtonItems = #[...];
Image: http://i.stack.imgur.com/RB3Rc.png
Edit 2:
I had tried to add a custom view on navigation bar:
//I added this line otherwise I not see the Navigation Bar!!
[self.navigationController.navigationBar setFrame:CGRectMake(0, 0, 320, 132)];
[self.navigationController.navigationBar addSubview:[self addTableHeader]];
and this is the result!!
http://i.stack.imgur.com/aksqb.png
This is working for me in iOS 7. Try this.
self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:[[UIBarButtonItem alloc]initWithTitle:#"ONE" style:UIBarButtonItemStylePlain target:self action:nil], nil];
My app is made with cocos2D 2.1, and I am using Xcode 5. After compiling, the UINavigationBar appears in my app on the top.
How can it be hidden? I have tried the other generic iOS 7 codes that seem to work for native iOS 7 Apps:
// None of the following works
navController_ = [[UINavigationController alloc] initWithRootViewController:director_];
navController_.navigationBarHidden = YES;
navController_.edgesForExtendedLayout = UIRectEdgeNone;
[navController_.navigationBar setTranslucent:NO];
if ([[CCDirector sharedDirector] respondsToSelector:#selector(edgesForExtendedLayout)])
[CCDirector sharedDirector].edgesForExtendedLayout = UIRectEdgeNone;
Set UIViewControllerBasedStatusBarAppearance to NO in the project's Info.plist.
Add this(with spaces) to your info.plist:
View controller-based status bar appearance -> Value: NO
I just updated my phone to IOS 6 but I have some issue regarding adding UIImageView on the UINavigationController navigationbar. This is my code
UIImage *logoImage = [UIImage imageNamed:#"navigationbar.png"];
UIImageView *logoImageView = [[UIImageView alloc] initWithImage:logoImage];
UINavigationBar *navBar = self.navigationController.navigationBar;
[navBar addSubview:logoImageView];
[logoImageView release];
This will add logo on navigationbar, it works great on the lower version of IOS 6. But on IOS 6 the logo shown but the back button was behind the logo so back button is not shown.
I don't want to override the UINavigationBar drawrect since I also have UINavigatioBar somewhere on the code for popup.
Any suggestions?
I think you don't need a UIImageView in IOS 6.
You can just put a background image in the UINavigationBar (for example in AppDelegate) like this:
[[UINavigationBar appearance] setBackgroundImage :[UIImage imageNamed:#"navigationbar"]];
Found a good site which explains some new user interface customisation in IOS 6:
click here