XCode 6 - Navigation Bar width Button - iphone

I have an "Any Any" View Controller. There I placed a Navigation Bar and set "Horizontal Center in Container". Now it's in the middle of my View.
But when I place a Bar Button Item on the right hand side of the Navigation Bar, it only disappears in landscape on my iphone 5s. How can I set the width of the Navigation Bar to 100%?
Thank you!

I'm no Auto Layout expert, but this works for me. You should have 3 constraints for your Navigation Bar:
Trailing Space to Superview
Leading Space to Superview
Top Space to Superview
These should all have constants of zero.
This process worked for me:
Delete the constraints for the Navigation Bar
Select the Navigation Bar in the Document Outline
Click the Resolve Auto Layout Issues button |-^-| and select Add Missing Constraints.

Related

Lower Z index of view in storyboard

I created a tab bar with UIView in the storyboard, and after that I decided to add a UIImageView under the tab bar view. The image must be at the bottom, behind the tab bar, but the image view overlaps my tab bar. How do I lower my image view's z-index to fix the problem?
I've already tried moving the tab bar up in the Document Outline:
Pictures for understanding:
First make sure the Document Outline is opened in your storyboard. It's the icon at the bottom-left of your screen.
Then just drag the image view before the tab bar. This will bring it to the bottom.

Draggable UIView is interacting undesirably with Tab Bar

I have a UIView that I can drag around the screen via UIPanGestureRecognizer. However, when I drag it down to the bottom of the screen, the view automatically starts to squish vertically when it touches the tab bar. If I keep dragging downward, it will eventually be allowed to drag under the tab bar.
I don't want it to interact with the tab bar at all though. It should just slide under it as if it weren't there. The view controller has Extend Edges Under Top Bars and Extend Edges Under Bottom Bars checked.
Why is the view interacting with the tab bar in the first place? And how do I prevent this behavior?
Finally fixed this by unchecking the "Extend Edges Under Bottom Bars" option on the view controller. The view now slides unimpeded under the tab bar.

Safe Area increase itself after hide tab bar, but dont decrease if i show tab bar again

i have a view controllers in a tab bar controller with constraints to bottom safe area, but one of them i must hide tab bar i use this
self.tabBarController?.tabBar.isHidden = true
this increase the safe area
But if i need to move to another i show back tab bar
self.tabBarController?.tabBar.isHidden = false
But safe area don't decrease by itself, making view contents behind tab bar
To make it clear i put a red view pinned to bottom safe area, next i go to view and hide tab bar
this is when it come back to this view and show tab bar again, safe area increased below tab bar, that's why red square are more below
It appears to be a bug in iOS. SafeArea doesn't change to account for tabBar, after hiding / showing it.
You can work around it by anchoring your view to superview and adjusting for tabBar manually. For example, if you want to anchor a tableView to a tabBar it would look like this
if let tabBar = tabBarController?.tabBar {
tabBar.isHidden = true
tableViewBottomConstraint.constant = tabBar.frame.height
}

Swift: How can I create a secondary Bar attached under my navigation bar?

The reason I want this second bar is because I want it to stay in the totality of my project. I want to have this bar under my navigationbar and stay constant throughout the run of my project.
The top red bar is the nav bar, and the top green bar is my bar. They will have different background colors. The orange/gray box represent the screens that will appear under these bars.
What is the best way to do this?
If it were me, I'd create a view controller called something like MyToolbarViewController and add its view as a child of your navigation controller. Use Auto Layout to give it a constant height, leading, trailing and top layout guide constraints. This will allow this view to remain in place while the navigation controller performs its normal transitions in which navigation bars are replaced with that slide/fade animation. To adjust the content in each view controller pushed onto the navigation controller, adjust insets or top layout guide constraints.

issue in StoryBoard: Other views at the top of the table view are not visable

I have started an app using story board.
In that i have used tabbar controller
In a view, I have Table view in that having a custom cell, And I have added a search bar at the top of the Table view. as shown bellow
The problem is when I add Search bar very close to the navigation bar, It does not display and if i added little down it was displayed
what was the issue is in 2px difference?
Go to IB Inspector
Select search bar and set AutoSizing Mask like this attached Picture.. Enable left, right, top and center position.