How to add image in
UINavigationBar in iPhone app
+(void)setNavigationBarAppearance{
[[UINavigationBar appearance]setBackgroundImage:[UIImage imageNamed:@"image name.png"] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], NSForegroundColorAttributeName,
[UIFont fontWithName:@"Font name" size:17.0], NSFontAttributeName,nil]];
}
To set title view of
UINavigationBar use below code
viewController.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourimage.png"]];
How to disable back
swipe gesture in
UINavigationController on iOS
From iOS 7 Apple added a new default navigation behavior. You can swipe from the left border of the screen to go back on the navigation stack.
So, It is possible to disable this new gesture in
UINavigationController.
Just add this online code and thats it.
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)])
[self.navigationController.view removeGestureRecognizer:self.navigationController.interactivePopGestureRecognizer];
OR
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)])
self.navigationController.interactivePopGestureRecognizer.enabled = false;
The
edgesForExtendedLayout property, together with the extendedLayoutIncludesOpaqueBars property, determines whether or not view controllers' views underlap top and bottom bars (navigation bar, toolbar)
|
Extenedges- iOS |
|
This is useful when you are using Storyboard and
UINavigationBar & you want to start counting frame after
UINavigationBar ends with autolayout.
so just select checkbox of Extenedges - Under top bars and thats it.