How do I show Placeholder Backgrounds in Xcode Interface Builder? - ios

How do I set and show custom Placeholder Backgrounds in Xcode 7's Interface Builder?
This functionality was added in Xcode 7, but I can't the way to set it.
Background placeholders on custom views and other containers can be hidden on the Interface Builder canvas by selecting Editor > Canvas > Show Background Placeholders. (20580948)
I've enabled in but nothing changed and I can't find where I can set a custom placeholder image:

A few years later and Xcode 10 still doesn't provide any of the flexibility you had in mind back then 😐
From Xcode 10 documentation:
Use placeholder backgrounds to identify image views, MapKit views, MetalKit views, GLKit views, and SceneKit views. Hide the placeholder backgrounds to focus on the content of your own views.
Choose Editor > Canvas > Show Placeholder Backgrounds to toggle showing placeholder backgrounds for certain types of views on the Interface Builder canvas.
The feature really is limited to only some of the built-in views from Apple (and even those that blue-ish background color is still pretty much hardcoded).

Related

UITabBarController icons not showing up

I have an app that has a UITabBarController with four view controllers embedded.
I've created icons for both normal and selected states and set them via the interface builder. The sizes of the individual icons vary slightly according to the new design guidelines. Also the icons are PDFs. I initially set it's Render As property to Template Image.
The titles of the tab bar icons show up but not the icons.
But they do show up in the interface builder though.
Then I set the Render As to both Original and Default but neither worked.
I'm using Xcode 10.1. What am I missing here?
It seems problem with image you are using. try setting different insets to image and tab bar icon will appear.
i have set some inset for icon and icon appeared in simulator.so you will need proper icon image for asset or would required proper inset for icons.

UIButton is out of navigation bar

I have a custom UI Button (just regular button but with image), within the navigation bar, but when I choose my image it looks like this in designer:
As you can see here, it's over my provider and status labels, and also when I run application it's over the WebView (which is bellow), so definitely out of navigation bar. I tried to find in storyboard some property where I can adjust this but I couldn't find any. I'm using swift and storyboards.
Appreciate any help, iOS newbie :)
Based on your description I think your issue is that you are trying to add a button for navigation. What you need is a NavigationBar with a NavigationItem/BarButtonItem in it. If you look in the object library you will be able to find these.
Just drag them onto your story board. Once there select the button and in the side menu you will be able to select the Image for that Item. Now it is in the navigation bar up top. Let me know if there are still issues. đŸ‘±đŸŒ
You have to make sure your 1x image is to the specified size (and then your 2x etc, or just use a PDF at the 1x size.
Icon sizes are here: iOS Human Interface Guidelines: Icon and Image Sizes
I made my pdf 22x22 and added it to .xcassets with scale factor "single vector"

How to specify vibrant appearance for secondary Today Centre widget text?

I am working on my first Today Centre widget, which simply consists of three labels on the default storyboard. It's working fine, but I read in the iOS Human Interface Guidelines that secondary text should "use the system-provided vibrant appearance" with notificationCenterVibrancyEffect.
What's the correct way to add this vibrancy effect to my two secondary labels? I've read about UIVisualEffectView, but it's still not clear to me how to use it for this purpose. I don't think I want to put a blurred view behind my labels because Notification Centre already blurs the background.
UIVisualEffectView when configured with a UIVibrancyEffect is meant to be used as a container—just drop your labels in its contentView and you’ll get the appropriate appearance on top of the Notification Center blur. The text color doesn’t matter; when it’s added to the contentView it gets special treatment and effectively always renders with the same appearance, though you can still adjust the alpha of the view (not of the text color) to make it more or less prominent.
good day, first of all u should use a correct view hierarchy, when U add some objects in your VisualEffectView example:
UIVibrancyEffect used in combination with UIVisualEffectView, adjusts the colors of the content to make it feel more transparent. UIVibrancyEffect can blending some objects
with the background example:
More particularly to your question(https://stackoverflow.com/a/25392645/4912496) Apple recommends to use vibrant effect for secondary text, because its simply beautiful for example(apple native app use vibrant effect, and Sports.ru don't use it):
But, some apps don't use this effect...
To ensure that your widget gets the vibrancy effect that’s appropriate for displaying items in the Today view, use notificationCenterVibrancyEffect.
Some info. https://www.omnigroup.com/developer/how-to-make-text-in-a-uivisualeffectview-readable-on-any-background

How to create buttons like in notification window on iOS8?

How can I create a button in a Today widget like the "edit button" in the picture below?
Is there a quick and standard way to do this or must I subclass a button and override it's draw method to draw a filled and rounded rectangle with transparency and background-only highlighting when touched down?
I am trying to find the best way to create exactly the same visuals for a button, instead of trying to imitate and match behaviour of it. Is it possible?
Segmented controls are a default within Xcode. It does most of the heavy lifting for you.
The UIKit Interfact Catalog in the iOS developer library should be helpful for you.
Within Xcode:
You will find segmented controls within the Interface Builder, in the Segmented Control section of the Attributes Inspector.
From here you can begin to build the visual styling and tie it to your code.
This should point you in the right direction.
More from apple is here: Segmented Control in the iOS developer library
They have great documentation, be sure you always seek that out.
From some quick tinkering I've got a UIButton that looks relatively close, you can tinker it some more to get it perfect. Here's a picture:
My buttons settings (the top one) has a height of 28, corner radius of 3, font color of black, and a background color of white with 31% Opacity. In the picture I was using text size of 15 but 13 or 14 looks a lot more accurate. I used the answers on this question as a reference point on how to create the rounded buttons.
Hope this helps some!

How do I replicate the iOS keyboard appearance?

I have made a custom number pad keypad for my iOS app, but want it to more closely mirror the appearance of the standard keyboard. I am looking for advice on how to make a standard UIButton look and act like the standard keyboard buttons.
Specifically, I need to figure out the following for the iPad and would like to do as much as possible in an xib or storyboard.
The size of the buttons
The color of the keyboard background (or even better, how can I determine this myself?)
The background color of the button
The font and color of the text in the button
How do I add the shadow under the button?
How do I have the button highlight with the grey color instead of blue?
The spacing between the buttons
How do I keep the "group" of buttons centered as a whole when changing the orientation? (all of the resizing options anchor it to a side and not to each other)
Do the standard buttons use images, or do they modify standard UIButton's? Or more appropriately, which is better for us to do?
UPDATE:
I have created a project for the number pad which is a complete working example. However, I have not spent much time on the actual appearance, which is what this question was mainly about. I have posted it on Github and made it an open source project (covered by the MIT licence, so commercial use is allowed as well). Hopefully other people will find it useful, and hopefully others will feel inclined to help make it better and look more like the native keyboard. The Github repository is at:
https://github.com/lnafziger/Numberpad
If you want to do it mostly in IB, then the following can be done:
Size
Colours
Background Color
Font
Text Color
Shadow (to UILabel's not UITextArea)
Spacing
AutoSizing
There is a cool PSD vector kit for all types of iOS elements that should help:
http://www.smashingmagazine.com/2008/11/26/iphone-psd-vector-kit/
Anyway, to the rest of the answers:
Size
Take a screenshot of the buttons and determine the size in Photoshop, or you can use CMD+i on the image file to see the pixel dimensions. Remember to use CMD+Shift+4 and then drag (and then Space to make the screenshot).
Colours
Use the DigitalColor Meter app that's preinstalled on the Mac, it's pretty cool for all kinds of functions.
Background Color for UIButton
The actual UIButton will have a background color of [UIColor clear], however, for the whole keyboard background, it would be best to create something similar in Photoshop and again using color pickers to get the right gradients. Then you could drag this into IB as a background image.
Font
Again, have a look at fonts/try Helvetica
Text Color
[UIColor black]
Shadow:
Programmatically:
[text setShadowOffset:(0,1)]; // One option
[text setShadowOffset:(0,-1); // Another option
[text setShadowColor:[UIColor whiteColor]];
But, you can also set the shadow in the IB inspector for a UILabel.
Button highlight
Look at the UIButton reference
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIButton_Class/UIButton/UIButton.html
Spacing & Rotation
If your using IB, then you could just drag on the buttons to whatever location.. IB has some autosizing options that determine where the buttons are spaced according to the TOP, LEFT, RIGHT and BOTTOM. You can also set if they are stretchable or not.

Resources