How to copy the background view of the actual Navigation Bar? - ios

How can I copy the actual UINagivationBar background appearance? I would like to have the exact background appearance to use on another view.

I don't think there's a direct way to access the gradient background of the UINavigationBar. You can, however, play around with mockup versions of the background here and create your own version using Photoshop.

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.

In iOS, is there any standard mechanism for color pickers?

I'm at a loss trying to find anything relevant to this question. Basically, I'm looking to write an app that's kind of like a color picker / swatch library (but with a certain purpose in mind) and I'd like to be able to use it in virtually any app that deals with color selection. Is there any built in, or perhaps novel way, I could either modify some config variable, or send some kind of signal that updates the current color? Or I guess the real question would be, is there any concept of a global color in iOS?
Maybe you are referring to tintColor?
From Apple guidelines:
Using Tint Color
In iOS 7, tint color is a property of UIView. iOS 7 apps often use a
tint to define a key color that indicates interactivity and selection
state for UI elements throughout the app.
When you specify a tint for a view, the tint is automatically
propagated to all subviews in the view’s hierarchy. Because UIWindow
inherits from UIView, you can specify a tint color for the entire app
by setting the window’s tint property using code like this:
window.tintColor = [UIColor purpleColor];
From Apple docs:
The first nondefault tint color value in the view’s hierarchy,
ascending from and starting with the view itself.
I hope that helps.

iOS Tab Bar questions (Swift)

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.)

How to create a see through button with "blurred" background in iOS 7

I am updating my app to iOS 7 and wanted to improve the UI. I want to create a see through background like Control Center. So basically I have a button, which I would like to have a see through and "blurred" background like control center. Thanks!
There's nothing to stop you using a UIToolbar.
Create a UIView as a base view with clear background, add a UIToolbar anchored to it's edges so it fills the view and then add your other controls to your base view above the toolbar.
It'll look for example like this:
The blurring effect is not available as a public API. There are third party implementations available, such as FXBlurView, which I can recommend.
You shouldn't really be using a toolbar. It's called toolbar for a reason.
One way to go would be to take a snapshot image of your background and blur it (you can use UIImage+ImageEffects category included in Apple samples to achieve consistent effect).
You can then just crop the image to desired frame and use it as a background of your button.
Are you looking to have a 'dynamic' blur effect (like in Control Center)? It's still doable, but it makes things more complicated.
You can also create blur effects with GUPImage Framework here is a full tutorial about it iOS blur effect tutorial. The tutorial also explains why you shouldn't use toolbar for blur effect creation

Resources