recreating the ipad search bar in the contacts app - ios

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.

Related

Adding home icon to the tab bar

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.

React-Native iOS: Hide the text input bottom tool and autosuggest bar

My text input field searches over unique content that never matches auto-suggest and doesn't need undo/redo functionality. Is there a way to hide this bar in react-native for iOS? I have spellCheck and autoCorrect both set to false but as shown in the image below, the bar remains only without those features.
I want to hide the whole thing. It is covering my interface!
Alternatively, I could move the UI up by that height when the text field is in focus, but I was hoping to avoid that.
BRyan! try setting autoComplete="off" as well. You might also want autoCapitalize="none" for this use case.

Default barTintColor and backgroundColor for UISearchBar

I'm trying to exactly recreate the appearance of the default UISearchBar with UIAppearance. The problem is, when I try and get the value of the variables in the title, they are nil.
I've tried [[UISearchBar appearance] barTintColor] and self.searchBar.barTintColor but to no avail.
I used the DigitalColor Meter in the Utilities folder to get the value of the bar normally, then set the background to white and set the barTintColor to the measured value. This almost worked, but the 'cancel' button blended in and dark lines appeared on the top and bottom of the search bar.
So I either need the default values for the two colours or a way to read said default values.
Given nobody has answered and this post is high up in relevant google search results, I'd like to give the answer that finally fixed it for me.
Simply setting the colour to nil works in making them use their default values.

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

How to set status bar tint color on iOS 6?

As shown on Apple's September 2012 keynote, the status bar tint color varies between apps in iOS 6. For instance, Safari and Maps use a black status bar whereas Mail adds a blue tint to it.
Is it possible to set that tint color, or at least force it to black?
You can do it from the plist like Comradsky mention or in xcode 4.5, they added an option for it in the project summary.
Update:
several people were confused by this answer. Just to clarify, you cannot set the status bar tint to any color you want. What is described above is only to change the status bar tint during launch and choose the iOS 6 default status bar color behavior (which picks the color of the bottom row of pixels from your navigation bar).
I've just found how to do it !
In your "Project Summary", in "Status Bar", set "Style" and "Tinting" to "Default.
Then, jump into you xib or storyboard and add a UINavigationBar just below the status bar.
Set the UINavigationBar "Style" to "Default" and select the "Tinting" of your choice.
Run! :-)
If, like me, you don't want any UINavigationBar visible in your Interface, all you want to do is putting the UINavigationBar behind all the Objects, or set the "Alpha" to zero.
You can do that in a tricky way..
In the Project Summary select Status Bar Style Black Transculent from the drop down menu.
In application: didFinishLaunchingWithOptions: enter the following line of code:
self.window.backgroundColor = [UIColor greenColor]; //example color
It works fine for me.
The tint color seems to be determined by the average color of the bottom pixel row of the app's header bar.
See here:
http://www.cultofmac.com/173928/how-ios-6s-cool-new-adaptive-status-bar-works/
It is very easy to do:
just put up an UINavigationBar in your .xib/storyboard, make sure the style is default.
then add a tint. no matter how many views, with different tinted UINavigationBar's, you have your status bar will change its color.
There is no way in iOS 5. You can just change your bar style.
In iOS 6 you can do it in the info.plist:
It is now possible to set status bar tint parameters in your app’s
Info.plist file. You might do this to ensure that the status bar color
matches the navigation bar color of your app during startup. To set
the status bar tint, add the UIStatusBarTintParameters key to your
Info.plist file. The value of this key is a dictionary with the
appropriate values describing the navigation bar your app has at
startup time. Inside the dictionary should be the UINavigationBar key,
whose value is also a dictionary. That dictionary contains the initial
navigation bar’s style (with the Style key) and whether it’s
translucent (with the Translucent key). If your navigation bar uses
them, you can also specify its tint color (with the TintColor key), or
the name of its custom background image (with the BackgroundImage
key).
Check out this link here
Edit:You can also do this in the project summary.

Resources