iOS Tab Bar questions (Swift) - ios

I have a couple questions about the iOS tab bar.
My first question is, is the image always tinted automatically? Say for example, I used an image that was colored red, is there a way to get it to show the red without tinting it? I guess what I am saying is, can you show the natural color?
My second question is, assuming the tinting is mandatory, how would I go about tinting the images in the tab bar that are not the currently selected image? I have the selected image tint figured out.
I tried changing the tint under, UIView.appearance() I believe and that worked, but when I selected a different tab, and then navigated back the color went back to the former grayish color.
If I am not being clear enough, let me know and I will explain more. I am using swift, so any examples you give would be great in swift! Thanks!

Say for example, I used an image that was colored red, is there a way to get it to show the red without tinting it?
What you want to do is to specify an image with rendering mode .AlwaysOriginal.
To govern both images, create the item with initWithTitle:image:selectedImage: and make them both .AlwaysOriginal.
(As you discovered, if you use a transparency mask and rely on the tintColor, you lose control of the tint color when unselected.)

Related

How to change the background of a Text View in the storyboard of xcode

I am running into a problem in xcode storyboard to setup the graphics of an app.
Nothing complicated, but I seriously don't understand the logic.
Import an image view that will be the background. It is set as opaque, alpha = 1, it uses an image found on internet and the background is "default". It covers the whole iphone surface
Import a text view. Now I am trying to have the background colour of the text view white.
To do that, on the "Text Field" section, I have tried to use an image of white, found on the internet, no success. I have also tried in the "View" section to set the "Background" to white colour with alpha=1 and opaque activated, no success, the text view background looks exactly like the background picture, it does not stand out.
Does anyone know how to do this ?
In case anyone wonders, I have been able to solve this programmatically using code lines like :
myTextField.backgroundColor = UIColor.white
Still not sure why it does not work on the interface builder though.

Why does this View display a dark background when set to Light Style?

My tableViews are working fine with Background = Default, but the rest of my views always display as Dark. What am I doing wrong? I am new to this...
I think the default background color of a view transparent. Probably Xcode is just showing it as black when it's actually transparent.
If you want an actual, adaptive background color, use System Background Color instead (this will be white or black). If you need different shades, there are also the Secondary and Tertiary options.
I would try hardcoding it in, like background = #fff(for hex0 or background = rgb(255,255,255). Sorry if it doesnt work, Im usually a flutter dev, not swift.

Make custom selected tab bar Item in iOS Swift

I am working on an application using Swift which needs to have a TabBarController and when user will select a tab then that particular tab bar item shows a 3d visual effect (Although it will be an static image I guess) which contains shadow and that tab bar item will be bigger in size as well with different tint colour.
Please see the attached image.
I have searched a lot on internet but no luck. Please someone help :(
Use http://cocoapods.org/pods/M13InfiniteTabBar
For as much as I do not like answers in the tone It can't be done, I feel that the specific of your screenshot, namely going outside of the UITabbar background, can't be done with UITabBarController.
You can use -initWithTitle:image:selectedImage:. Documentation found here

UIbutton highlight part of the image

I want to have a UIButton that has an image as the button itself, to have a nice highlight when pressed but not on the entire rectangle but on the object in the image (quite similar to what Twitter is doing on the status bar buttons)
I thought that making an image with the background as transparent will solve the problem, the thing is that on one it works, and on one it doesn't and they are exactly the same property wise.
So my general question:
What are the steps I need to do in order to get this done?

iOS: Back toolbar bar button item

I need the back arrow toolbar bar button item.
In identifier of bar button item, there is play, refresh, reload, and stop.
I need the image of play, but flipped 180 degrees.
Is there a way to flip the image with code? If not, where can I find this image?
here's a simple work around:
declare your button with "initWithTitle" and set the title to #"◀" (it's just a unicode symbol).
Use #"▶" for the forward button to make it consistent.
I tried it and it worked for me.
Do a Google search for play button vector graphic. Make the one you want the image of the button. Should still be able to tell the button to maintain it's bar button style.
One straightforward option is to draw a white triangle of the appropriate size and orientation in an image editor, stick it in an image view, and then use that image view for a bar button item's custom view.
I wouldn't try to use the UIBarButtonSystemItemPlay image. I don't know if manipulating system images is expressly proscribed, but Apple generally doesn't smile on misuse of system items. When you get right down to it, it's just a white triangle, so it'd be hard to tell the difference between drawing your own or reversing theirs. That just seems like all the more reason to draw your own.

Resources