Questions tagged [titleview]

A custom view displayed in the center of the navigation bar when the receiver is the top item

Declaration

OBJECTIVE-C

    @property(nonatomic, strong) UIView *titleView

SWIFT

   var titleView: UIView?

If this property value is nil, the navigation item’s title is displayed in the center of the navigation bar when the receiver is the top item. If you set this property to a custom title, it is displayed instead of the title.

Custom views can contain buttons. Use the buttonWithType: method in UIButton class to add buttons to your custom view in the style of the navigation bar. Custom title views are centered on the navigation bar and may be resized to fit.

The default value is nil.

Availability

Available in iOS 2.0 and later.

Reference:

titleView Reference

98 questions
0
votes
1 answer

iPhone navigationBar titleView sync request problem

Here's my situation: I am making synchronous HTTP requests to collect data but before hand I want to place a loading view within the navigation bar title view. After the request is over I want to return the titleView back to nil. [self…
cha55son
  • 423
  • 3
  • 12
0
votes
2 answers

SearchBar goes out of UINavigationItem frame when it is active

I placed searchController's searchBar in navigationItem as the titleView as follows: self.navigationItem.titleView = self.searchController.searchBar; Although it fits perfectly when it is not selected (cancel item is not shown), if it becomes first…
0
votes
1 answer

how to set width of navigationTitleView and Truncate label by swift3

I have a problem about navigation titleView. The titleView cover my right barbuttonItem and out of screen. I need titleView just in center region and have right region for barbuttonItem. I want to know how to set width about my title, because I…
0
votes
1 answer

centering titleView in navigationItem

I am trying to center my titleView in my navigationItem. After localizing my app, I saw this behavior: This is my code as an extension to navigationItem: extension UINavigationItem{ func makeImg(){ let container = UIView(frame: CGRect(x:…
JVS
  • 2,592
  • 3
  • 19
  • 31
0
votes
1 answer

TitleView of UITableViewController's UINavigationItem image not visible

I am using Swift 2.3 in Xcode 7.3. I have a UINavigationController with a UITableViewController. I am trying to set the titleView of the navigation item in the navigationBar to create a button centered in the navigation bar. The indexTextBut is a…
0
votes
3 answers

Can't set titleView in Navigation bar center and scope of back button increased

I am trying to push a view controller and set its navigation bar's title but it is not centered due to long title being used i guess. Along with that, scope of the back button is increased till the title view, i.e if I tap with with Milestone's "M",…
Zeeshan Anjum
  • 148
  • 13
0
votes
1 answer

inputAccessoryView not shown when editing navigation bar titleView

I use a simple inputaccessoryView to display next and previous buttons when a user inputs text in a couple of UITextFields. I have also added a UITextField as the titleView of the navigation bar to allow a user to set a custom title. Everything…
Glitch
  • 619
  • 2
  • 7
  • 16
0
votes
0 answers

How can I customize the animation for the titleView?

In my UINavigationController I have set the titleView of a viewcontrollers NavigationItem. Now I want to add a custom animation to this, how can I do this? If you want to post an example, I want to animate the title up and fade it out when it…
vrwim
  • 13,020
  • 13
  • 63
  • 118
0
votes
2 answers

UIViewController custom titleView crashes app

I have a navigation based iPhone app. When you press on a cell in the tableview a new UIViewController is pushed to the navigation stack. In this view controller I am setting a custom titleView in the viewDidLoad method: - (void)viewDidLoad { …
Cornelius
  • 4,214
  • 3
  • 36
  • 55
0
votes
1 answer

iOS nav titleView size

I add a UILabel as the titleView as self.navigationItem.titleView. The width of the label is the width of the screen and the origin is CGZero. After I add a left and right bar item the UILabel's origin and width changes in relation to the screen. I…
kdgwill
  • 2,129
  • 4
  • 29
  • 46
0
votes
2 answers

Maximize Width of TitleView

I'm using a storyboard and added a UIView to a navigation item with 2 sub UILabels. I want the UIView to be the maximum width possible. I noticed that I cannot use auto-layout to create constraints to do this. This means I get results like this. Is…
Hackmodford
  • 3,901
  • 4
  • 35
  • 78
0
votes
3 answers

Add 2 lines of text on Navigation Bar in IOS using TitleView

I have to add two lines of text with different font sizes on Navigation Bar using Title View. I have tried the following code: I want EREDITOMETRO as bold with large font and LA SUCCESSIONE A PORTATA DI MANO with small font UILabel * label…
Anagha Magar
  • 21
  • 1
  • 6
0
votes
1 answer

Customising same UINavigationBar within app multiple times

I am customising UINavigationBar with different color and custom font by using titleTextAttributes. However, when I moved to another view, I would like to use different color from previous with same custom font. I have used, [[UINavigationBar…
Abhay
  • 118
  • 1
  • 5
0
votes
0 answers

Variable width title UINavigationController

What I have : +-------------------------------------+ |< Back [ Current Long Title ] | What I want : +-------------------------------------+ |< Previouse Long [ Current Long...] | I've tried setting custom titleView on my…
Losiowaty
  • 7,911
  • 2
  • 32
  • 47
0
votes
2 answers

iOS Image in navigation Item titleview

I want to add an image in my navigation bar. To do this, i wrote that : self.navigationItem.titleView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"logo.png"]]; It's running, but the only problem is the image seems to be…
deveLost
  • 1,151
  • 2
  • 20
  • 47