Can I change horizontal position of UINavigationBar's title?
Like this image (MY ACCOUNT is the UINavigationBar title)
Use your own UILabel, assign it to your view controller's navigationItem's titleView. You can left align the text in the label.
Change the position of the navigationbar title will be difficult.
In my experience, I could use either one of below two ways;
Set left button.
When you set title and image both to UIButton, it will be exactly same look as like as you want.
And set that button to the left button of navigationItem.
You can create new view which contains UILabel which have that position and set that view to navigationItem's titleView
Related
I have an image for middle UITabBarItem which should start from the bottom and align with existing UITabBar. How can I change the height of UITabBarItem for middle item?
To achieve this you need to use your custom TabBarView. It is a simple view, that pinned to the bottom. Design like you want and that's all! This is the best way without issues with working default TabBar.
every "not default looking" tab bar - it is custom
I would like to add a label in the left bar button item with multiple lines of text. the height of the navigation bar will be changed according to the height of the label.
You can add view in left bar button item and add label inside it and give the label constraints as you want to it's superview.
if you want to increase navigation bar height, You can add space in prompt like below image but you can't increase it throw navigationBar.frame, it doesn't work with me.
I have the following setup within my app. There is a footer bar that has a number of buttons on, above that there is a UIImageView that currently has the constraints set to 10,10,10,10 for all edges. I have added an image below to show the constraint.
Now what I would like to do is when a button on the footer bar is clicked a new "sub bar" will appear between the footer bar and the UIImageView. My question is how do I adjust the constraint so that the bottom anchor is connected to the new sub bar and not the footer. In a sense it pushes the UIImageView up to make way for the new bar?
I don't want the new bar to go over the UIImageVIew, instead I want to push it up with an animation.
Create that bar between the imageview and the footer and layout it properly then make its height constarint = 0 to be hidden at first, then control darg this constarint as IBOutlet and when you want to show change its constant to say 100 and call:
[self.view layoutIfNeed];
Put it in a UIView animation if you want it animated.
The navigation bar can take a UIImageView via the titleView property,
for example
self.navigationItem.titleView, and the The UIImageView can be animated.
Unfortunately, as per the documentation "Custom title views are centered on the navigation bar and may be resized to fit". This resizing makes it unsuitable for me.
My goal is to animate a UIImageView in something like a navigation bar, tab bar or toolbar. In other words I want to animate UIImageView in a bar that is always visible in a view.
How would I do this (using swift)?
A possible solution is to create a UIBarButtonItem with a UIImageView in the constructor and set the left or right button in the navigator bar to the animate button item.
In my application I want to set the tab bar items at uneven positions inside the UITabbar (meaning the space between 1st and 2nd is not equal to the 2nd and 3rd and so on)
I know there is no such options as the item don't have a frame property. so is that possible to achieve this by some other ways like
self.tabBarController.tabBar addSubview:buttonItem
Or is it Possible to reposition the items in the desired location inside tab bar?
In your storyboard, you can drag and drop a "Fixed/Flexible space bar button item" into your toolbar. This will serve as a separator between buttons. Also, Drag and drop an outlet connection to the controller if you want to control its width programmatically. You can also adjust the spacing through the inspector (look for the width property). For example if your Fixed space bar button item's outlet name is spacer, you can set the width of the spacer as follows:
self.spacer.width = 50; (or whatever value)
Hope this helps.