uinavigationbar

Make the navigationbar title clickable swift

帅比萌擦擦* 提交于 2019-12-31 09:32:14
问题 I would like to make the navigationbar title to be clickable. When user click on it, it should perform a segue. But I have no idea how to do this. I have tried the following to get the title and apply the Tap gesture to it. var subviews = self.navigationController?.navigationBar.subviews if let subviews = subviews { // Better check for array length before accessing to the 1st element var subview = subviews [0] } but its giving me error Variable subview inferred to have type AvyObject, which

How to enable swipe gesture when navigation bar is hidden?

偶尔善良 提交于 2019-12-31 05:22:12
问题 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 =

presentViewController does not show Tab Bar or Navigation Bar

坚强是说给别人听的谎言 提交于 2019-12-31 05:12:06
问题 I am new to Swift and have been struggling with this for a while. I am trying to redirect users based on login status to either "Login" viewcontroller or "Home" viewcontroller. "Home" viewcontroller has NavigationBar and TabBar and it shows a table. But, when i use the following code, i see only the table. NavigationBar and TabBar are not shown at all. var view = self.storyboard?.instantiateViewControllerWithIdentifier("HomeViewController") as UIViewController self.presentViewController(view,

UINavigationBar title label text

南楼画角 提交于 2019-12-30 20:32:09
问题 Is it possible to get the title text to shrink to fit in the UINavigationBar in iOS. (for portrait iPhone app with no autolayout). I'm setting the title bar dynamically but sometimes the text is too long and at the moment it just cuts it off with an ellipsis. i.e. "This is the t..." I'd like it to shrink the text instead. 回答1: You can create your own title view to make it. Something like this: - (void)viewDidLoad { [super viewDidLoad]; //Do any additional setup after loading the view,

Get rid of the space on the right side of a UINavigationBar

假如想象 提交于 2019-12-30 09:57:13
问题 So, this is what I'm trying to accomplish: It's a UINavigationBar with a UIBarButtonItem that gets initialized with a custom UIButton . Basically like this: UIButton *favoriteButton = [UIButton buttonWithType:UIButtonTypeCustom]; [favoriteButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; favoriteButton.frame = CGRectMake(0.0f, 0.0f, 44.0f, 44.0f); UIImage *backgroundImage = [[UIImage imageNamed:@"favorite-button-background-orange"]

Adding image to navigation bar

被刻印的时光 ゝ 提交于 2019-12-29 10:16:11
问题 I'd like an image to take up all of a navigation bar. This is the navigation that comes with a navigation based app. It appears on the RootViewController with the accompanying UITableView. I've seen some examples of how this might work. Set navigation bar title: UIImage *image = [UIImage imageNamed:@"TableviewCellLightBlue.png"]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; [self.navigationController.navigationBar.topItem setTitleView:imageView]; The problem there is it

UIButton in Navigation Bar Not Recognizing Taps in iOS 11

痞子三分冷 提交于 2019-12-29 06:56:49
问题 I have a UIButton in a navigation bar that sits over the top of a UIImage and a UILabel . It worked fine in iOS 10, but now in iOS 11 it doesn't recognize any taps from my @IBAction outlet. I tried moving the tap outlet to the bar button item, but that didn't work either. The UIButton has the following constraints: I confirmed that it's there by giving it a green background, so I know it's visible and available. Any idea what's going on? 回答1: I found a solution from another developer. You

UIButton in Navigation Bar Not Recognizing Taps in iOS 11

倖福魔咒の 提交于 2019-12-29 06:56:11
问题 I have a UIButton in a navigation bar that sits over the top of a UIImage and a UILabel . It worked fine in iOS 10, but now in iOS 11 it doesn't recognize any taps from my @IBAction outlet. I tried moving the tap outlet to the bar button item, but that didn't work either. The UIButton has the following constraints: I confirmed that it's there by giving it a green background, so I know it's visible and available. Any idea what's going on? 回答1: I found a solution from another developer. You

How to make UINavigationBar background transparent?

我的梦境 提交于 2019-12-29 06:45:31
问题 First of all, I've seen all the answers at How to make UINavigationBar Transparent in IOS 8? Transparent UINavigationBar and Make UINavigationBar transparent. They just don't seem to work for me. My regular view controller (before trying to make the navigation bar transparent) doesn't have any issues: I'm using (tried both in viewDidLoad and viewWillAppear: ): [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; self

How to make UINavigationBar background transparent?

◇◆丶佛笑我妖孽 提交于 2019-12-29 06:45:10
问题 First of all, I've seen all the answers at How to make UINavigationBar Transparent in IOS 8? Transparent UINavigationBar and Make UINavigationBar transparent. They just don't seem to work for me. My regular view controller (before trying to make the navigation bar transparent) doesn't have any issues: I'm using (tried both in viewDidLoad and viewWillAppear: ): [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; self