Questions tagged [uinavigationitem]

on iOS, the UINavigationItem class encapsulates information about a navigation item pushed on a UINavigationBar object’s stack

UINavigationItem is a part of the UIKit framework and is available from iOS 2 and later. The UINavigationItem class encapsulates information about a navigation item pushed on a UINavigationBar object’s stack

UINavigationItem Class Reference

1143 questions
31
votes
2 answers

Placing a custom view based UIBarButtonItem in the navigation bar without default horizontal padding

How do I remove the horizontal padding to the left and right of custom left and right UINavigationBar items? There seems to be ~ 10 points of padding that iOS sets by default. I'm customizing left and right navigation bar buttons (I have given up on…
idStar
  • 10,674
  • 9
  • 54
  • 57
29
votes
5 answers

Best practices for handling changes to the UINavigationItem of child view controllers in a container controller?

Suppose I have a container controller that accepts an array of UIViewControllers and lays them out so the user can swipe left and right to transition between them. This container controller is wrapped inside a navigation controller and is made the…
Reid Main
  • 3,394
  • 3
  • 25
  • 42
29
votes
2 answers

navigationController.navigationItem vs navigationItem

Just curious, why setting self.navigationItem = ... works, but self.navigationController.navigationItem fails? The same applies for self.toolbarItems vs self.navigationController.toobarItems. When to use…
limboy
  • 3,879
  • 7
  • 37
  • 53
28
votes
8 answers

Change navigation bar bottom border color Swift

It works with import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. …
TheoF
  • 795
  • 2
  • 7
  • 16
28
votes
2 answers

Add a button next to the back button

in iOS, is it possible to add a button next to the default back button (the one that is automatically created when you use the method pushViewController) I've tried to use the methods setLeftBarButtonItems and setBackBarButtonItem but in vain -…
Arnaud
  • 7,259
  • 10
  • 50
  • 71
27
votes
13 answers

Adjusting navigationItem.titleView's frame?

I noticed that the titleView's position depends on the rightbarbutton title. How can I set the frame of the titleView to be in the center instead? I've tried setting titleView.frame, but to no avail. Here's the code: UIButton *titleLabel =…
Sidwyn Koh
  • 1,742
  • 2
  • 21
  • 29
27
votes
2 answers

UINavigationItem: Difference between title and prompt

I want to use a navigation bar, and I realize that it has title and prompt. What is the difference between them?
offset
  • 1,407
  • 1
  • 16
  • 34
25
votes
6 answers

Can't assign multiple Buttons to UINavigationItem when using Storyboard with iOS 5

I'm a iOS developer with a lot experience in developing the UI by code. I'm now testing the Storyboard functionality, because I testing to switch to "design" the UI rather then implementing it. In the past I stuck with to much limits using nib/xib's…
user810395
  • 291
  • 1
  • 3
  • 7
25
votes
2 answers

iPhone Title and Subtitle in Navigation Bar

In my application, I'd like to have the navigation bar display a title and subtitle. To that extent, I added the following code to my view controller: // Replace titleView CGRect headerTitleSubtitleFrame = CGRectMake(0, 0, 200, 44); UIView*…
Reuven
  • 2,142
  • 3
  • 18
  • 30
25
votes
3 answers

Change Spacing Between UIBarButtonItems in iOS 8

I have a UINavigationItem on my view controller, and I am trying to reduce the spacing between my two RightBarButtonItems. Here is some of my code: // Create two UIBarButtonItems let item1:UIBarButtonItem = UIBarButtonItem(customView: view1) …
Alexander
  • 3,959
  • 2
  • 31
  • 58
25
votes
6 answers

Change width of a UIBarButtonItem in a UINavigationBar

I am creating a UIBarButtonItem and adding it to my navigation bar like so: (void)viewDidLoad { ... // Add the refresh button to the navigation bar UIButton *refreshButton = [UIButton buttonWithType:UIButtonTypeCustom]; [refreshButton…
Darren
  • 10,091
  • 18
  • 65
  • 108
24
votes
5 answers

UIViewControllerRepresentable: Navigation Title and Bar Button Items Ignored in NavigationView

I have a UITableViewController subclass that I have wrapped in UIViewControllerRepresentable. I have set the navigationItem.title and navigationItem.leftBarButtonItems in my view controller. I present my UIViewControllerRepresentable instance as…
24
votes
1 answer

How do I obtain the height of UINavigationBar.navigationItem programmatically?

I am creating a custom UIToolbar to use as a UIView in the UINavigationBar.navigationitem.titleView property. I would like to size the toolbar height to that of the .navigationitem by obtaining the current height of the .navigationitem rather than…
ChrisP
  • 9,796
  • 21
  • 77
  • 121
23
votes
2 answers

Customize navigation bar by adding two labels instead of title in Swift

I am trying to add two labels in the place where the title is shown in navigation bar, but I am struggling to do so. It would be very nice if I could achieve this with storyboard but as I can see I cannot do it. As I have seen I need to use…
Ilir V. Gruda
  • 1,562
  • 5
  • 17
  • 23
22
votes
4 answers

iOS rightBarButtonItem on UINavigationController in swift

I'm trying to put a rightBarButtonItem on a second view controller of an UINavigationViewController stack. I'm creating and setting the button in viewDidLoad of the view controller that I want to show. My actual code looks like this: override func…
1
2
3
76 77