uinavigationbar

presenting ViewController with NavigationViewController swift

偶尔善良 提交于 2019-11-27 17:14:47
I have system "NavigationViewController -> MyViewController", and I programmatically want to present MyViewController inside a third view controller. The problem is that I don't have navigation bar in MyViewController after presenting it. Can you help me? var VC1 = self.storyboard.instantiateViewControllerWithIdentifier("MyViewController") as ViewController self.presentViewController(VC1, animated:true, completion: nil) stefandouganhyde Calling presentViewController presents the view controller modally , outside the existing navigation stack; it is not contained by your UINavigationController

NavigationBar bar, tint, and title text color in iOS 8

自闭症网瘾萝莉.ら 提交于 2019-11-27 16:40:43
The background text in the status bar is still black. How do I change the color to white? // io8, swift, Xcode 6.0.1 override func viewDidLoad() { super.viewDidLoad() self.navigationController?.navigationBar.barTintColor = UIColor.blackColor() self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.orangeColor()] } In AppDelegate.swift , in application(_:didFinishLaunchingWithOptions:) I put the following: UINavigationBar.appearance().barTintColor = UIColor(red: 234.0/255.0, green: 46.0/255.0, blue: 73.0/255.0, alpha: 1.0) UINavigationBar

IOS7 : UIScrollView offset in UINavigationController

浪尽此生 提交于 2019-11-27 16:38:53
I'm currently migrating my app on ios 7 and I've been stuck for hours on the new navigationcontroller/bar management. Before, when we had a navigation controller, we had a snippet like this : UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:[[MainViewController alloc]init]]; In interface builder, we had the choice to set an existing navigationbar for the view and everything match the content of the real view. OK so now, i have no clue of how to design properly with interface builder. I still have my snippet to initialize my navcontroller.

Button color in Navigation bar - iPhone

耗尽温柔 提交于 2019-11-27 16:25:27
问题 How do you to set the tint of this yellow button to be gray? I have tried adding an image, but have had no luck. Here is the screenshot: Here is my current code: - (id)initWithStyle:(UITableViewStyle)style { if (self = [super initWithStyle:style]) { UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Settings", @"") style:UIBarButtonItemStyleDone target:self action:@selector(GoToSettings)]; [addButton setImage:[[UIImage imageNamed:@"bg_table.png"] retain]];

How to remove UINavigationBar and UISearchBar hairline

核能气质少年 提交于 2019-11-27 15:22:18
问题 I am creating an iOS 7 app in which I'd like to have a SearchBar right bellow the NavigationBar, and I wanted them both to look like a single piece. Therefore I need to tint them with the same color (done already) and remove that hairline at the bottom of the NavigationBar and at the top of the SearchBar. How can I achieve that? 回答1: Officially, this is only possible by setting the shadowImage of the navigationBar to an empty image. However, a closer look at the documentation, it is said: For

setting image for UIBarButtonItem - image stretched

纵然是瞬间 提交于 2019-11-27 14:36:18
When I try to use UIBarButtonItem's "initWithImage" to initialize a navigation bar custom image, it comes out washed-up and stretched against a black navigation bar. This is how I create it: UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"gear.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(showSetting:)]; Here is what it looks like: Any idea if it's a problem with the image? I got it from a set of icons I bought. The displayed images on bar button items are 'derived' from the source image (it uses only the alpha channel values in

Adding back button to navigation bar

▼魔方 西西 提交于 2019-11-27 14:08:06
I've added a navigation bar to a UIViewController. It is displayed from another UIViewController only. I'd like to have a left side back button that is shaped similar to an arrow, just like the normal navigation bar back button. It seems I can only add a bar button through IB. I'm guessing the back button needs to be added programmatically. Any suggestions on how I should do this? Currently, in the RootController, I push another UIViewController (viewB) by simply doing an addSubView. In viewB, I want to display the navigation bar. The app is view based, not navigation controller based. If you

iOS 7: Custom Back Indicator Image Position

与世无争的帅哥 提交于 2019-11-27 13:49:49
问题 I'm having trouble setting properly a custom back indicator image. The indicator is not centered! Here is a pic: I'm setting the indicator image in didFinishLaunchingWithOptions: method... - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIImage *image = [UIImage imageNamed:@"Back"]; [UINavigationBar appearance].backIndicatorImage = image; [UINavigationBar appearance].backIndicatorTransitionMaskImage = image; return YES; } How can

Remove Gradient on UINavigationBar

≡放荡痞女 提交于 2019-11-27 13:21:34
问题 How can I remove the default gradient on a UINavigationBar? What property do I set to do this? 回答1: You can remove the gradient and set your own solid color by popping this code into the class that has the navigation bar. You can change the UIColor to whatever color you need. Note that this code needs to be outside of another implementation, so whatever .m file you put it in put it before the @implmentation of the class already implemented in that file. @implementation UINavigationBar

iOS7 when UIsearchbar added in UINavigationBar not showing cancel button

和自甴很熟 提交于 2019-11-27 12:45:11
I add UISearchBar above UINavigationBar and set UIsearchbar showsCancelButton YES, work fine in iOS6 but in iOS7 not showing cancel button. I used below code snippet UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 600, 44)]; searchBar.showsCancelButton = YES; searchBar.translucent = NO; [searchBar setTintColor:[UIColor redColor]]; searchBar.backgroundColor = [UIColor yellowColor]; [self.navigationController.navigationBar addSubview:searchBar]; For some reason iOS7 does not show the cancel button when added to a navigation bar. This also happens if you try setting