Label over a button - ios

I'm trying to put a label over a button, but I'm not succeeding...
Here's what I have. I'd like the text "tap to dial" to actually be over the dark grey area, not below it. How do I do that?
On the left side of the image is the view hierarchy, the red things left and right are the button add and button remove, so you get the whole picture.
EDIT: Explanation - The label I'm trying to place over the button is the hint what the button does. The button itself will hold different text contents, thus I need an additional label.
EDIT 2: I don't know why is this question marked with negative votes, why don't people explain that in the comments? Let's pose the question differently: if one wanted to put a label over an image, how would that be done?

Select both objects in IB (Interface Builder) and then create constraints so they have both have the same vertical and horizontal center. If the text is under the button then select the text view and choose "move to front" from the editor menu.
All that being said, why don't you use a titled button with a gray background rather than trying to put a label on top of your button?

A button is a label (that is, its title is). So you don't need a button and a label; just configure the label of the button. The label is the button's titleLabel and you can make it do anything a label can do — including consisting of multiple lines, one of which is smaller than the other, as shown here:

The solution I was looking for was to embed the button and the label in a view. Inside the view they can be positioned to overlap each other, while the view itself can be constrained by auto-layout.

Related

How to make a tableview fill all the available space?

This is my first swift application, so apologize if it's very basic. I was unable to find it...
In my view, I've a Navigation on top (Navigation Controller) and It's using a TabBar Controller. I'd like to make the TableView fill the whole empty space no matter the size of the device nor orientation.
I set the property Content Mode to many different options, including Aspect Fill, but all the options can't cause any effect.
Any clue about it ?
First make your tableview completely fill the screen and then set the constraints to be in 0 margin from all sides, like in the image
use constraints for display full table view on empty space.enter image description here
Click on pin icon from bottom side of Xcode.
Select all for four(up,down,left,right) constraints and set 0 value for all.
after then click on add constraints button and refresh frame(click on right side button of Pin button and select Update Frame).

Center UIButton with image next to it

I'm trying to create a UIButton where the facebook icon is a part of the centering, however i can't seem to figure out how to make it part of the centering process. So far i've just created a UIButton with the text. I could just create a image next to it, however then it will not be part of the centering.
You can easily set image and title both for your button for different control state like normal,selected or highlighted etc.
So, set your image and title to your button from storyboard or programmatically there is no need to take separate imageview for image.
You can set edge insets for title and image both from interface builder or programmatically. you can manage top or bottom edge insets for title and image of button to manage it's vertical appearance!
check screen shot below,
Update : (as asked in comment)
For example,
this is the setup for my back button with image!
Provide button title and image for normal state. Then just change the left inset for image as per image

How to add tabs in the cell of tableviewController

hello I want to know how can I add tabs in the tableviewcontroller like this
I want to add tabs Contact and About similar to image and also a line between them. These tabs are in the mid of screen not at the bottom.
I have another question is when I press my thumb on this image portion and move my thumb downwards the image size increases. How can I do that. When I do in my controller white background comes up.
You could put buttons at the bottom of the cell and then have the button handlers reload elements in the cell's view.

Sibling object not available in menu when setting Auto Layout constraint in Storyboard

The Apple guide "Adding Auto Layout Constraints with the Pin and Align Tools" states:
To create a constraint related to another item that is not the nearest neighbor, click the black down arrow in the text field and choose another nearby item from the pop-up menu.
https://developer.apple.com/library/ios/recipes/xcode_help-IB_auto_layout/chapters/pin-constraints.html
My Storyboard has a UIView containing a UITextView and a UIButton.
I'll note that these objects are not visible "on the storyboard" in a view. They're only visible in the left sidebar due to the limitations of Interface Builder. So I cannot place the button "to the right" on the storyboard by default (if that's what's causing this problem).
I need to add a constraint between the Text View and the Button. The Text View should be on the Left, followed by the Button, with a Margin between.
However when I add a constraint, the two objects used are the Text View and the parent UIView. Not the Button.
The "nearest neighbor" of the Text View should be the button.
I'm also unable to select the button as the second item from the menu, as the guide advised. Only the parent UIView is available.
Why is the Button object not available in that menu?
How should I add a constraint between the Text View and the Button?
The views only show up that make sense for the direction you chose. So, if one view is above another, and you choose the left or right constraint, the other view does't show up. If you choose the top constraint, it should.
Another way to do this is to control-drag from the text view to the button in the scene list, and choose the constraint you want from the popup window. After you create the constraint, you can edit it to change the value if you need to.

ios any UIView property allows me to set buttons underneath the view in-active?

For ratation and iAd and design reason, I don't want to use modal view to present a message (not via alert view either). I plan to bring up a screen-sized label up and show the message there. That can be done. However, there are a bunch of buttons (ABCD etc) underneath the big label and those buttons are logged in different status and they are clickable. Ideally a user would read the label and disable it via a specified button (X). However, users could click anywhere they want and more than often they will hit those buttons underneath the big label and screw up things. When the big label shows up, only X is visible, and ABCD etc are invisible. Now my question is there any UIView property or whatever property that I can set so that buttons that are invisible are not functioning, although they might be enabled.
You can set the alpha property on your buttons to 0. This will have 2 effects:
1) make the buttons invisible
2) make them ignore the user input
When you need to re-enable the buttons, just set their alpha to 1 again.

Resources