I am having a problem with my icons in my tabBar.
Tapping the same tab bar button repeatedly will keep increasing the tab bar icon's size.
If I push a different one, it goes back to its original size.
Any ideas what I should fix?
As per the project shared by the OP (see question comments), it seems the tab bar image insets seem to be messing things up.
Steps to resolve the issue:
Select the tab bar item of the problematic ViewControllers in IB
Go to Size Inspector section (on the right)
Ensure your image insets are balanced
If you give 5px inset to top then balance with a -5px inset to bottom
If you give 5px inset to left then balance with a -5px inset to right
I have no explanation for this, sorry... but if anyone does then kindly comment/post
try This..
myDealNavigationController.tabBarItem.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
I was also running with same issue and above accepted answer helped me.
Just to show case what steps to do:
While setting image to tab bar select image and balance image insets from all sides.
Need to keep few things in mind:
As shown in below image, balance from all four sides.
It will make UI proper.
Thanks
Related
I’m implementing a design that requires the navigation bar to visually appear to be 64px tall (even though the content fits inside the standard height). The standard UINavigationBar height on iOS is 44px and it is strongly discouraged try to to change the that (see: https://developer.apple.com/forums/thread/88202?answerId=274620022#274620022).
So, what I’m trying to do instead is to add a padding of 10px both above and below the bar itself, but I can’t figure out if this is even possible.
I am able to extend the bar by 20px by setting the UINavigationController’s additionalSafeAreaInsets.top = 20, but the bottom of the navigation bar is still flush with the bottom of the navigation controller, and I need it to be -10px from bottom.
So, my question, is this possible, or am I chasing a ghost here?
EDIT: To clarify, I want it to look like how the navigation bar looks in the iMessage conversation view, i.e. a tall navigation bar, but with vertically centered content.
I think you should make a customized navigation bar to solve this issue.
Because built-in UI is not easier to adjust or customize. I have tried many tricks but they didn't work.
I already made a base screen that automatically adds a navigation bar on top, just need to set left/right button and the label. This navigation bar is just a normal UIView.
I am trying to add a basic Settings icon in the top right of the navigation bar. I added a UIBarButtonItem to my navigation bar. Then I set the image, but it moved the image to the center instead of staying in the right? Is there a way to fix this?
Update: I fixed this by decreasing the dimensions of the icon closer to 40x40. It was too large.
As you can see in the image (in the UIBuilder), the UINavigationBar takes up probably 60px of space at the top, but that does NOT show up in the simulator. The image you see above it how I have to put those view in order for them to be as far from the top of the status bar as they are from the sides. How can I fix this?
As suggested by user vaibhav, this fixed the issue.
You need to click on your main view, go to attribute inspector, and un-click 'Adjust Scroll View Insets'. That is all. Thanks for the help!
What I need,
What I get, on adding backButtonImage,
I want to shift the backButtonImage horizontally? No answers on here seem to work for me.
Any suggestions will be welcomed.
EDIT
I am just setting back image and back mask in storyboard, here it is (nav_back)
Have a look at UIBarButtonItem Size Inspector in storyboard.
You should be able to shift image to the right by X points by setting image left inset to X and right inset to -X. This worked with bar button item with custom image but not sure if it will with default back button
I'm currently following the udemy ios8/swift course and I'm completely stuck on the navigationbar part. I'm thinking it might have something to do with the fact that I'm on a higher version of Xcode, but can't seem to find the solution.
I have to set the constraints for the navbar on 0 on 3 sides so it will be centered and full width in both landscape and portrait mode. When I try to do this, I see a option thats not there on the course (Constrain to Margins). No matter how much I try to adjust the values, the navbar keeps disappearing or moving in the wrong direction. I tried unchecking the constrain to margins function and putting everything on 0, I tried 'resetting to suggested constraints' and lots of other options, but I can't seem to get my navbar look good in both landscape/portrait mode. So basically, what am I doing wrong or is there any other way to do this?
In addition to the three constraints you need to give the navigation bar a height.
Another solution is to add a navigation item to the view controller instead of a navigation bar. A navigation item will auto format a navigation bar at the top of the view.
I've been able to fix it by manually setting the constraints to 0 in the Attribute inspector after Ctrl-dragging to create them first. Not sure if this is the ideal way, but it solved my problem for now.