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
2
votes
1 answer

NavigationItem Titleview centered on the navigationbar under IOS 7 - impossible?

I'm asking since the usual answer, modifying the frame in viewDidLayoutSubviews, does not work - unless you can find a mistake in my code. The frame gets set to the correct width and height, but iOS 7 does not respect the frame. Currently, the app…
Henrik Erlandsson
  • 3,797
  • 5
  • 43
  • 63
2
votes
0 answers

UINavigationItem titleView with dynamic width

I am using the titleView property of a UINavigationBar inside a UINavigationController. Is there any way to have the titleView's width be dynamically adjusted to fill the space in between the any buttons on the left and any buttons on the right?…
2
votes
1 answer

change UINavigationItem titleView text

I'm using custom titleView for navigation bar in viewDidLoad, here is my code: UILabel *titleView = [[UILabel alloc] initWithFrame:CGRectMake(50, 0, 220, 44)]; titleView.text = @"Hello"; titleView.textAlignment =…
krisrak
  • 12,882
  • 3
  • 32
  • 46
2
votes
2 answers

Add a UISegmentedControl as the titleView in a UINavigationController

I'm trying to add a UISegmentedControl programmatically as the titleView in a UINavigationController. But it did not show up. Upon further investigation, I found out that the titleView property is ignored if the leftBarButtonItem is not set to nil…
Isuru
  • 30,617
  • 60
  • 187
  • 303
2
votes
3 answers

UINavigationItem.titleView canBecomeFirstResponder?

I have a custom UITextField added to the UINavigationItem.titleView. But it is not becomeFirstResponder. Why so? - (void) viewDidLoad { [super viewDidLoad]; UITextField *titleTextField = [[UITextField alloc] initWithFrame:CGRectMake(65.0f,…
1
vote
1 answer

make custom navigationbar titleview

I have a custom view for my navigation bar title, which I am setting like this: UIImageView *titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"CustomTitleView.png"]]; self.navigationItem.titleView = titleView; This works as…
Matt Green
  • 185
  • 1
  • 11
1
vote
1 answer

How to change back bar button's width of a UINavigationController in iPhone?

I have two table view controllers. Say TableViewController1 and TableViewController2. I push TableViewController2 when someone clicks on the TableViewController1's cell. I set the TableViewController1's clicked cell's value as the…
Confused
  • 3,846
  • 7
  • 45
  • 72
1
vote
1 answer

Tableview y origin not animating properly when navigationItem.titleView is hidden (Swift 5)

I’m trying to get the tableView to move up when the search bar does. Take a look at the problem: I think I see what the issue is here, but I can't think of a solution. In SearchResultsUpdating I have an animation block: func updateSearchResults(for…
1
vote
0 answers

How can you create a navigationItem.titleView that is greater than 40 pixels in height under iOS13.3?

Using Swift 5.1.3, iOS13.3, XCode11.3, I try to create a custom navigationBar Title and use the navigationItem.titleView to do so. Everything works fine if the custom titleView is of small size (around 40-45 pixels). The reason is most likely…
iKK
  • 6,394
  • 10
  • 58
  • 131
1
vote
1 answer

Xamarin.Forms 4.0 Shell TitleView iOS cannot set black background color

I am working for a company that brand guideline requesting title view having black (#000) as background color. I am using Xamarin.Forms 4.0 Shell to build the app. Android is working great but iOS is "not that black". To demonstrate the problem, I…
Samuel Leung
  • 85
  • 2
  • 11
1
vote
1 answer

Making the nav bar title a button (Swift)

I'm trying to make the title of the nav bar its own button. Users in my app can have multiple profiles, and the nav bar title displays the username of their currently selected profile. Pressing this button should bring up a list of available…
1
vote
1 answer

Xamarin.Forms TitleView FillAndExpand not working with Android

I created a TitleView in Xamarin.Forms. The view works on iOS, but on Android it will not fill up the parent: The red area is the background of the Tabbar. Aqua the background of the TitleView. For me, it looks like there is some padding or…
mklieber
  • 192
  • 11
1
vote
0 answers

How to change the size of the titleView of Navigation Item? (Swift)

In my app I want to change the titleView of my Navigation Controller to a custom ImageView but I have a very strange problem. I basically just can`t set the frame of my ImageView. This is my code: func NavBarEinrichten(){ let logo =…
1
vote
3 answers

Stackview in navigation bar

Is it possible to place UIStackView in NavigationBar programmaticaly using swift? I want to place there StackView with two arranged stackviews. But when i do that , it shows nothing in navigation bar. If it is possible, please provide example.…
Rufat Abdul-zade
  • 115
  • 2
  • 11
1
vote
1 answer

Multitple Navigation title text - swift

I am trying to display names on a custom navigation title For long names it is truncating, How do I display the text in multiple lines for long names, Here is the code I used for custom titleView nameLabel.font = UIFont(name: “Arial-Medium", size:…
Vineesh TP
  • 7,755
  • 12
  • 66
  • 130