Adding home icon to the tab bar - ios

I want to implement a bar at the bottom of the screen with the home button - exactly like in Instagram or Messanger apps. I was trying to use a tab bar (https://developer.apple.com/ios/human-interface-guidelines/bars/tab-bars/)
And I would like to utilize system home icon for the tab bar button/item (https://developer.apple.com/documentation/uikit/uiapplicationshortcuticontype/1623374-home)
Is there any simple and straight forward way to set this home icon for the tab bar item?
Some icons can be selected directly from the list in the button/item properties in Xcode, but this home icon is not among them.
I also saved the png from the link above, resized it to 30x30 and added as a picture for the button/item, but it's just showing a grey rectangle.

Apple may or may not provide you with some images. In general no one uses stock images but provide their own. You should do the same.
So "Adding home icon to the tab bar" is pretty much the same as for any other tab bar item. You can add your image and/or text that represents your "home" button. Some images may already be at your disposal but others must be made/bought/stolen by you.
The image you use in tab bar item is only used as a mask and not as an explicit image. What that means is that only alpha component of the image will be taken. In your case you have a black icon on white background which from alpha perspective means you have a rectangle. You will need to remove the white background and make it transparent or use another image that already has these properties.
I am not sure for tab bar but you might also try to open your assets, select your image and then in options on the right find "Render as" and set it to "Original image". Even if this will work the results will not be as you desire (at least in most cases) due to a white background on the image.
In general this option is used to set it to "template" which means whenever you use this image on your components such as UIImageView it will use it's tint color and image alpha component instead of the actual colors from the image. It is a very useful tool but again I am not sure it will work on tab bar item.
You should stop wondering if Xcode is designed to be overcomplicated. Putting aside numerous amount of bugs (and there is really a lot of them) and it being slow (it really used to be faster) it is designed very nicely. But tab bar view controller is extremely high level component. If you don't like it the way it is then simply create your own. All you need is a bottom view with your N buttons which may be shaped any way you can possibly imagine and a container view on which you set a new view controller when one of those buttons is pressed.

Related

How do I use both solid and outline icons in a tab bar like the App Store app?

I would like to have my tab bar similar to the App Store app (picture below). The active section has a coloured solid icon, and the other non-active sections will have the uncoloured outline icons. How can I switch from outline icon to solid icon depending on if it is selected or not? I would preferably want to accomplish this in interface builder but if thats not possible please explain how to do it in code. I have also provided a picture of my current tab bar. Notice how all of the icons are "outline" icons including the active section icon (I want the active section icon to be "solid"). I do have both the outline and solid icon sets, i'm just not sure how to use them both.
My current tab bar:
App Store tab bar (what I want but with my color not blue):
"You can use storyboard to set selected image of tabbar. I tried and it worked for me. Select the UITabbarItem and add a run-time attribute 'selectedImage', select Type as 'Image' and give the name of your image as its value."
iamge that shows how it's done
Had the same problem, answer from here: Setting Selected Image in Tab Bar Controller with Storyboard

IOS Developing:Tab Bar Item's Image Display a Blue Square

The bar item images I prepared are about 35*35
and I use the Sketch to export the [1x & 2x] size images;
(I can't insert any images for instances at here because of my zero reputation//Sorry about this!)
Then it displays a blue square :<
the function and title of Item is OK
BUT just the icons are wrong
Could someone tells me how to fix it!
Appreciate!!!
I figure it out!
There is nothing wrong with your code or setting
It's about your IMAGEs
You can just look at the apps on your phone.(almost)Any tab bar item icons are in gray.
So the Icon will just display their UN Hollow parts in gray!!
[Additionally,according to official API,they wrote like this:
By default, unselected and selected images are automatically created from the alpha values in the source images. To prevent system coloring, provide images with UIImageRenderingModeAlwaysOriginal.
]
Consequently the solution is : USE Sketch to make your instance's icon heart-part to be hollow
You need to add #3x image too.

How to set all views to a dark color and all text to white in iOS?

I'm using Xcode 6.
My app ist by default all white background and black text, text that is present in the title of the nav bar, the table views content, and the tab bar for example.
I would like that all my views (the tab bar and nav bar too) to be dark gray and hence all the text previously mentioned to be white.
Should I set it up for each view of my numerous view controllers, or there is a way to set it up for all the views of the app ?
Thanks for the advice and help
The right way would be to set it up everywhere manually yourself. Because it will be helpful for people in the future to see what you are doing and where.
Another way, which is equally correct would be to create your own customUIViews which would by default channge their colors to grey, and customUITextField which will turn their text white and same goes for labels.
Or use Categories on top of the existing classes of UI, and create a function setUpColor/setupFontColor, and call that function everwhere you want. (I would personally go with the very first solution.)

In Xcode Interface Builder - why are the options in the Editor--->Arrange menu (containing Send to Front, Send to Back) often disabled?

What I'm trying to do is simple: bring a label in front of an image within a subview.
But all of the options for arranging are disabled/un-selectable when my label is selected. I find this happens often.
What could be the reason that I'm almost never allowed to change the z-axis of my objects in the Arrange menu? Is it a better practice to avoid this feature and set the order of views programmatically?
It can depend on how you have selected the label (similar to how the label can only be moved with the keyboard when selected in some ways).
A simple alternative is to look at the list of view in the pane on the left and to drag the views up and down to change the order.
It happens sometimes. In that situation, click the view or image you want to send back then you will see little square box at the edges of image from which you can re size your image, Just click on it once and then go to Editor > Arrange > Choose option according your need.

recreating the ipad search bar in the contacts app

In the contacts app, the search bar is shown with a white background and it blends in well with the surrounding UI. The only style choices in Interface Builder don't seem to show a way to host just the search bar, but instead includes chrome around it to make it look slightly 3d.
Is there a way to get rid of the surrounding chrome and simply have the search bar overlaid on my own view's background (which happens to be flat black)?
You could use the UIBarStyleBlack .barStyle, or set the .tintColor to black, or set the .translucent to YES.
However, there's no documented way to change the background image of a search bar.
You may use a UITextField with a custom .background and .leftView to simulate the look of a UISearchBar.

Resources