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.
Related
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.
Using storyboard and Swift, I have a view controller which has two elements on it. A UITextField, and a UIView, which I use merely to give a colored border to the UITextField. The UITextField is a child of the UIView. See:
The problem I am having is that despite having set the top bar and bottom bar simulated metrics attributes to Opaque Navigation Bar and Opaque Tab Bar respectively, See:
When the app builds and runs the top of the UIView is always underneath the nav bar. My over all feeling is that this is somehow a constraints issue but I have not been able to find the solution to it. How do I set the constraints so that the UIView is always immediately underneath the nav bar, and the bottom of the view is always just on top of the tab bar?
Select your UIView in storyboard and assign constraints to the top margins and to bottom margins. There is a 'Pin' button you use to do this that looks something like a Tie-Fighter ship in Star Wars, it is located at the bottom right of your storyboard view.
This will set margins to stretch to top and bottom always.
That is what the layout guides are for. Pin the top to the Top Layout Guide and the bottom to the Bottom Layout Guide. The guides will always move to adjust for any top and bottom bars.
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
I have a UITableViewController in a Storyboard that I'm adding as a subview to a lone UIView in a UIViewController, my end goal is to get the UITableView flush up against the status bar so that scrolling goes underneath the status bar (not through it with clashes).
I have configured the lone UIView to have constraints of 0 on both verticals and horizontals but as demonstrated in the image I believe autolayout is then adding the 20px y offset that I am including in the layout. If I remove the 20px y offset (and size the UIView to the whole layout) I end up with the clashing.
I suggest you to set up your view controller as follows. Create a UIViewController in IB and add a simple UITableView as a subview of its main view. I almost never use the UITableViewController because it has almost no added value but it restricts you in adding subviews to your table view. Now, you position your table view's origin to (0, 20) and set up the top layout constraint of the table view to the top layout guide instead of the superview. Maybe you should open the drop down menu close to the constraint constant value in IB:
This way your table view will start right under the status bar.
Note however that iOS 7 design guidelines suggest that you would in fact extend the content under the top bars (nav bar and status bar). You should create a 20 points high semi-transparent background png, position it under the status bar, and leave the table view to scroll under the status bar. In this case you should also not forget to check in the "Adjust scroll views inset" option of your view controller.
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.