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
4
votes
2 answers

My UINavigationitem's TitleView getting expanded in ios 6

In my app I have applied an image on uinavigation item. It is running fine in iOS 5 but getting expanded on iOS 6. I have no left or right bar button item in navigation bar. I searched too much but couldn't find answer. Here is my code: UIImageView…
iEinstein
  • 2,100
  • 1
  • 21
  • 32
3
votes
4 answers

UIButton style when added to navigationItem.titleView

I need to add a button to the UINavigationItem titleView (actually to the center of the UINavigation Bar. I've used the following code to accomplish so: UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.frame = CGRectMake(0, 0,…
Muhammad Hewedy
  • 29,102
  • 44
  • 127
  • 219
3
votes
2 answers

Remove left space in title view xamarin forms

I had an issue in removing the extra left space in title view as shown in the image below please see the screenshot here Ps: I'm using tabbed page and that bar is the navigation title view.
3
votes
2 answers

Xamarin Forms Shell TitleView does not center image

I have an app that uses the new Shell in Xamarin.Forms. I added the following code to one of my pages in an attempt to use the TitleView area to display my app header image centered. (FYI - I have tried Center for both of the alignment options and…
George M Ceaser Jr
  • 1,497
  • 3
  • 23
  • 52
3
votes
0 answers

A proper size for navigationItem.titleView

I would like to have a custom titleView that fills the useful spaces besides the BarButtonItems. @property (strong, nonatomic) IBOutlet UIView *testView; in ViewDidLoad _testView.frame=CGRectMake(0, 0,…
Orange
  • 349
  • 3
  • 13
3
votes
0 answers

navigationBar change titleView with animation

I would like to change the content of my titleView in the navigationBar to display different kinds of information, for instance a UIsegmentedControl or a UILabel. The change of the information should be a done with a transition (segmentedControl…
user2014551
  • 325
  • 5
  • 17
3
votes
1 answer

How to fix titleView being masked to navigation bar during transition?

In my view controller I am setting the titleView to a UIView which contains a UIImageView which is made into a circle using setCornerRadius on its layer. The top half of the circle is positioned over the navbar, and the bottom half over the view,…
3
votes
0 answers

Trying to set titleView for navigationItem works on simulator but not on actual device

I'm trying to set a titleView in the NavigationBar using the following code. It shows correctly on the simulator but it doesn't on the device. This is my code: UIImage *imageTitle = [UIImage imageNamed: @"tittle_SW.png"]; UIImageView…
Renexandro
  • 464
  • 5
  • 13
2
votes
1 answer

iOS 16 additional empty space in navigation item

When I creatе the simplest titleView with iOS 16 and add it to the navigationItem I see an additional space that I cannot remove in any way. I did not have this issue on iOS 15, does anybody know what can be done? The issue I am trying to solve is…
2
votes
1 answer

How to set image for NavigationBar title using SwiftUI?

I want to set an image in the titleView of NavigationBar using SwiftUI. We can do this by using UIKit as below: navigationItem.titleView = UIImageView(image: UIImage(named: "logo")) This is how we do it in UIKit. How can I use SwiftUI to achieve…
Sourav Mishra
  • 501
  • 4
  • 21
2
votes
1 answer

TitleView not covering the entire toolbar

I am developing notification count on Toolbar using TitleView. Inside TitleView I have used RelativeLayout which is cropping from top side not showing full count circle Label. This is my code:
R15
  • 13,982
  • 14
  • 97
  • 173
2
votes
1 answer

VoiceOver reads accessibility label twice when focusing non-UILabel titleView

I'm encountering a strange issue with VoiceOver. Goals: Set a UIStackView containing multiple UILabel's as my navigationItem.titleView. Mark the stack view as an accessibility element and set its accessibilityLabel to an appropriate value. Set the…
rzulkoski
  • 63
  • 1
  • 6
2
votes
1 answer

Xamarin.Forms SearchBar inside TitleView takes full width

I am trying to add a SearchBar to the TitleView so that the SearchBar takes the full width of the TitleBar without hardcoding the width property (WidthRequest). But the SearchBar is displayed with the minimum required width and does not take the…
Kamir
  • 21
  • 5
2
votes
1 answer

Use imageView as title for Navigation Bar with preferLargeTitles

I would like to use a custom icon with text as the title for a Navigation Bar with preferLargeTitles enabled. The custom title needs to be large and left centered at first then resize when scrolling. This is what it should look like: Large…
Emre Cakir
  • 21
  • 3
2
votes
2 answers

Swift Add UIView with subviews to titleView

I'd like to customize my navigation bar and insert a UIView with two subviews into the title view of the navigation bar. Unfortunately the subviews aren't displayed. Do you have any idea why? let titleContainer = UIView() …
N. Beer
  • 109
  • 1
  • 10