iOS Tab Bar icons keep getting larger
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
ViewController
s 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
Tab Bar icons too small despite being correct size
Image icons of 75x75 px should be fine for @3x devices.
If the title is nil, image will not expand on itself.
However you can shift the image using offset property.
Go to Size Inspector in storyBoard, and change image inset's Bottom offset.
Refer to this link for more info
Moving UITabBarItem Image down?
iOS7 Tabbar icons too big
Keep 60x60px icons but rename them as iconName@2x.png which iOS will automatically reduce to 30x30 points, roughly to half of the original size on retina devices.
If you are using assets catalogue, please make sure your icons are set to 2x icon sets.
Tab Bar Icon Size
You should not do this yourself system can do it automatically.
here is Apple Human Interface Guidelines, where you can find icon resolutions:
https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/custom-icons/
for example:
If you are using circular icons for tab bar item you should create following sizes for portrait mode:
- 75px × 75px (25pt × 25pt @3x)
- 50px × 50px (25pt × 25pt @2x)
- 25px × 25px (25pt × 25pt @1x)
and for landscape mode:
- 54px × 54px (18pt × 18pt @3x)
- 36px × 36px (18pt × 18pt @2x)
- 18px × 18px (18pt × 18pt @1x)
after you add this icons into Assets.xcassets or somewhere, you can select Tab Bar Item icons from storyboard:
select Tab Bar item and in the attributes inspector, choose portrait image for image field, and landscape image for landscape field.
After that system will do everything for you.
TabBarItems and setting their image sizes?
You should prepare 3 images icons for each tab bar item (1x, 2x and 3x).
First create the 3x at 75w 75h pixels (maximum: 144 x 96) and save it as iconTab0@3x.png.
Then resize it to 50w 50h pixels (maximum: 96 x 64) and save it as iconTab0@2x.png.
Finally resize it to 25w 25h pixels (maximum: 48 x 32) and save it as iconTab0.png.
Now all you need is to select those 3 images at your finder and drag them to your image assets.
Human Interface Guidelines
Related Topics
How to Hide/Show Tabbar When Tapped Using Swift in iOS8
Ios: Place Uiview on Top of Uitableview in Fixed Position
Watch Os 2.0 Beta: Access Heart Beat Rate
How to Change the Size of Uiactivityindicator
Uitextview Starts at Bottom or Middle of the Text
How to Generate an iOS IPA File with Ionic Framework
Open Specific View When Opening App from Notification
Disabled Uibutton Not Faded or Grey
How to Apply a Tintcolor to a Uiimage
Uirefreshcontrol - Pull to Refresh in iOS 7
Export Compliance in iOS App Submission
Swift 3: Expression Implicitly Coerced from 'Uiview' to Any
Change Size of Uibarbuttonitem (Image) in Swift 3
Unified Uiviewcontroller "Became Frontmost" Detection
Loop Through Subview to Check for Empty Uitextfield - Swift
iOS in App Purchase: Test a Real Purchase Without Submitting to Apple
Modifying Ekparticipants (Attendees) in Eventkit Like Sunrise