uinavigationbar

Adding multiple custom bar buttons to custom nav bar

那年仲夏 提交于 2019-12-02 11:09:12
I need to add two bar button items to each end of my custom navigation bar in Swift. I'm using the following method, and although I get no errors, nothing at all is appearing. I'm using my own custom icons, which do appear when I add them using interface builder. Obviously, I can only add one to each end that way. @IBOutlet weak var navBar: UINavigationBar! override func viewDidLoad() { var iconOne = UIImage(named: "iconOne") var iconTwo = UIImage(named: "iconTwo") var buttonOne:UIBarButtonItem = UIBarButtonItem(image: iconOne, style: UIBarButtonItemStyle.Plain, target: self, action: nil) var

Trying to construct a tableview with a navigation bar at top

╄→гoц情女王★ 提交于 2019-12-02 11:08:02
Here's the code I used. What am I missing? - (void)loadView { CGSize screen_size = [[UIScreen mainScreen] bounds].size; CGFloat navBarHeight = 40; UINavigationBar *nav = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, screen_size.width, navBarHeight)]; UITableView *table = [[UITableView alloc] initWithFrame:CGRectMake(0, navBarHeight, screen_size.width, screen_size.height - navBarHeight) style:UITableViewStylePlain]; table.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; table.delegate = self; table.dataSource = self; table.editing = YES; [table

Objective-C: Background image and title in Navigation Bar

落花浮王杯 提交于 2019-12-02 09:58:49
问题 In need a background image AND a title in my Navigation Bar. For the image I write a category: @implementation UINavigationBar(MyNavigationBar) - (void)setBackgroundImage { UIImageView *aTabBarBackground = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"navBarBackgrd.png"]]; [self addSubview: aTabBarBackground]; [self sendSubviewToBack: aTabBarBackground]; [aTabBarBackground release]; } @end I call this category in my AppDelegate and have background images in the whole application:

UINavigationBar does not overlap to UICollectionView in swift 4

笑着哭i 提交于 2019-12-02 09:54:26
I put Navigation bar inside UICollectionView in swift 4. When I scroll the collectionView, it does not goes to back layer and it overlaps to Navigation Bar. self.collectionview.contentInset = UIEdgeInsetsMake(40, 0, 0, 0) I also write this code but it does not work. I also unselect the "Under Top Bars" in Extend Edges in Attributes Inspector. All the ways do not work. Can anyone help me please? 来源: https://stackoverflow.com/questions/46376475/uinavigationbar-does-not-overlap-to-uicollectionview-in-swift-4

How to add scope buttons in a UISearchController embedded in UINavigationController

孤者浪人 提交于 2019-12-02 09:32:35
I have an App that is presenting a MKMapView embedded in a UINavigationController. In the UINavigationController I have put a UISearchController. When the User touch the UISearchController it displays a UITableViewController. It works well while I'm not adding the Scope button in the UISearchController. Here the screenshot of the UISearchController in the UINavigationController when I start the App. Next when I touch the UISearchController, it displays the UITableViewController and scope button. Here we can already see there's an issue with the scope button because they are not well integrated

iOS 8 - Set Status Bar Color (when your UINavigationBar has a nil backgroud image)

痴心易碎 提交于 2019-12-02 08:28:09
问题 I am using a view pager in my app (specifically ICViewPager). To make the View Pager blend into the Navigation bar like so: I had to put these lines of code in my AppDelegate.m [[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault]; [[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]]; However, this causes the status bar not to be the same color as my navigation bar. How do I set the color of my status bar to be the same as

Change color of UINavigationBar

旧时模样 提交于 2019-12-02 08:27:55
Hello, I created UINavigationBar , and I try to change the color bar to aqua color (As in Nib file) How do I do it? ratul [[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:0 green:.62 blue:.984 alpha:1]]; Dude, try this to get [UIColor Aqua] throughout your app. You can set either tintColor or backgroundImage to your UINavigationBar - (void) viewDidLoad { //set background image [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"background.png"]]; //OR set background Color [self.navigationController.navigationBar setTintColor:[UIColor blueColor]]; }

iOS 13: threading violation: expected the main thread

拈花ヽ惹草 提交于 2019-12-02 08:07:15
The app is being crashed when trying to hide the navigation bar for a viewcontroller only for iOS 13 users. I got the crash on Crashlytics of Fabric which titled as below, Fatal Exception: NSInternalInconsistencyException threading violation: expected the main thread The app is being crashed on this line of viewWillAppear method, self.navigationController?.isNavigationBarHidden = true To hide the navigation bar on the viewWillAppear method of UIViewController, I am using below code, override func viewWillAppear(_ animated: Bool) { self.navigationController?.isNavigationBarHidden = true super

Add UICollectionView to NavigationBar

≯℡__Kan透↙ 提交于 2019-12-02 08:00:49
问题 I'm trying to add a UICollectionView as a SubView to my NavigationBar. [self.navigationController.view addSubview:self.hotspotCollectionView]; It seems to work properly but covers the back button, see the screenshot attached. Is there anyway to indent the collectionView so that the back button is properly visible? Also is there a way to increase the height of the navigationbar so I can use bigger thumbnail pictures in my CollectionView? I'm using XCode 7 and iOS9. 回答1: I was able to achieve

How to enable swipe gesture when navigation bar is hidden?

走远了吗. 提交于 2019-12-02 07:35:13
I've been trying to solve this issue for quite some time and cant figure it out. I have the current set up: In each view controller I hide the navigation bar like so: self.navigationController?.setNavigationBarHidden(true, animated: true) The issue is I loose the swipe gesture on the view controllers that the navigation bar is hidden. I need to have the animation enabled and cannot use: self.navigationController?.navigationBar.isHidden = true self.navigationController?.isNavigationBarHidden = true Any help would be awesome as I'm sure many people has ran into this issue. Thanks! Here is the