Custom Tab Bars in swift and xcode 6 - ios

I have created a custom tab bar with some of my own images for the individual tabs. However, the images are far too large for the tabs. Is there any way I can resize these images either programatically or through Xcode's own utilities so that they will be in the correct dimensions for the tabs?
Many thanks.

Xcode does not allow to resize images. I think it is better to resize image manually, not programmatically. This link describes the iOS icon standard sizes. You can easily resize images with standard Preview.app.

Related

User Interface of an iOS apps seems to be enlarged for unknown reason

I took over two iOS projects from my predecessor in the company and I have some problems with one of the apps.
The program works correctly, but compared to other apps the graphical interface of the second app seems somehow enlarged.
The navigation bar is higher, the text in the navigation bar is larger. Text in table cells is larger. Even UISwitch objects are larger. I guess around 50%.
I can't find a reason for this different appearance in the code. Even if I drag a new UISwitch onto a view it is bigger than in other apps or bigger than the switches in the iOS settings.
Is there a global setting that enlarges the complete view of an app?
Is there a image file named Default.png, Default#2x.png or Default-568h#2x.png in the project?
If yes, remove that image from the project may help.

Reduce size of UINavigationBar buttons

I noticed that Xcode 7.x interface builder add buttons on the UINavigationBar that are slightly bigger than those used by the standard apps, like the mail app. The add button (+) and back (<) are smaller in the standard apps. I want to keep the standard buttons, but I want them with the same size of the other applications. Do anyone know how to achieve that? Thank you.
Simply modify the size of the images in your assets catalog. Remember to customize each image based on the associated screen resolution.
In the image above, the 1x is what you would see on a smaller/lower resolution device, while 3x is what you would see on a larger/higher resolution product.

Set images for different iphones and debug

I am currently developing an ios app and the scope is limited to iPhones only and portrait mode only.
In each screen there are images, buttons, labels and textFields. The question here is, how do I render appropriate image for device from the Images.xcassets?
What I am doing now, written below -
From Sketch design application, exporting my images for 1x, 2x and 3x (Screens designed by a UI designer)
Adding them to Xcode project (drag and drop from finder to xcode)
Add new image set in Images.xcassets (naming it as "MyImages") and drag drop my images for 1x, 2x, 3x.
In the storyboard, on a viewcontroller, adding an ImageView
For the image view, selecting Image as "MyImages" from Attribute Inspector.
Once the above steps are complete, when I test the app on simulators starting from iphone4s, iphone5, iphone5s, iphone6 and so on.. (all the simulators available on Xcode 7.3), I don't see the appropriate image is being rendered.
Is my approach correct?
Also, how do I debug a UI element on the screens? Like, how/where do I check for what image is rendered? Its size (W X H)?
Added Screenshot
#Lohith Korupolu:
The screen shot you provided is for universal size (iPhone/iPad). From the additional information provided in comments, this would lead to issues with AutoLayout constraints that would stop the image showing on screens of a smaller size than that shown in your StoryBoard.
E.g. I have replicated your issue on storyboard...
This results in the following in Simulator for iPhone 4s....
i.e. Text is there but NO IMAGE.
REASON: The autoLayout Constraints set for the larger "Universal" Screen on any of two opposite sides would make the image invisible/ disappear when viewed on a smaller screen.
SOLUTION:
1. Clear the Autolayout constraints for this selected Image in Storyboard. See next picture...
2. Add AutoLayout constraints as below x2 pictures. (Top constraint, Height + Width) (horizontally in container). Remembering to tick "Items of new constraints" for both.
3. Run Simulator for iPhone 4s... E.g.
** The same situation is occuring with the other iPhone size simulator Runs. **
****** All Working ******
They should all be 2x images for iPhones apart from the plus size iPhones which should be 3x. Is that not what you are seeing?
In terms of debugging / checking this - you can put place holder images in your assets with labels or different colour tints to distinguish them from each other and then replace them later with images that give the desired final appearance once you know that everything is working as expected.
Using 2x images for iPhones approach works fine, however, there is another more straight forward way without having to resort to multiple image files for 1x, 2x, 3x in Xcode, by use of good large quality PDF (vector).
1. Create a Large PDF of the image/Graphic image you want to use
2. Import it into 'Assets.xcassets' - drag and drop (Into Xcode)
3. Go to the utilities panel on the right for the 'Attributes Inspector' (when the image is selected)
See Screen shot (a)
Under 'Scale Factors' the selection from 'Multiple' to 'Single Vector'
Now when you got to 'StoryBoard' and add the image - Simply select the PDF's name.
Xcode will automatically render it to correct size etc at run time for you. All the work is done by Xcode.
Exceptions:
It does not work well with images for icons inside the TabBar or Navigation Bar Items.
Note:
Vector graphics are sharp and ideal for High Definition (HD), but although Xcode accepts the Image Asset as a vector from the PDF, it doesn't seem to keep the vector but converts it into an actual image with pixelation problems when zoomed in, from a HD perspective.

Design Custom Icons for IOS Tab Bar

I was wondering how to create high quality custom IOS Tab bar icons. I've been following the Apple Human Interface guidelines and have made the 30x30px images they recommend in Illustrator.
For some reason the icons with curved edges get pixilated. I believe this has to do with the transparency I have to set. On icons I made that use nothing but straight lines there are no rough edges. See the icons below.
I was wondering if anyone knew of any tutorials or had instructions for making high quality icons for the tab bar that don't get pixilated when transparencies are added. I have the entire CS6 suite so I can use any program in there.
Thanks
Create #2x versions of the images which are 60x60 and see how they look.

Icons in tabbar are not displayed correctly

I have an issue with iPad application. I'm porting the iPhone app to iPad. In iPhone, all is working in order but when convert to iPad (Universal app), the tabbar controller looks like this
(vertical lines) Do you guys have any ideas why?
Thanks for any comments or guides.
This can not be in default TabBar. I am sure you are using custom tabbar and its layout are not managing properly in iPad.
So make some adjustment in your custom tabbar and then use it.
Hope it helps you.
Try to check autosizing mask (or autolayout) if you use them.
Then try to check if you change its frame (it could disable autosizing).
It also seems you want to draw these separators manually but tab bar appearance depends on iOS version. At general I advice you to use custom images to a whole tab bar, not its items.

Resources