How to center an image and button to another button - swift

I want to center an image and button to another button. I do not know how to do this. It would be appreciated if someone can show me through the storyboard interface and not code. Thanks
I tried selecting both and control dragging it to the button I want it to center with. However, it just center the button rather than both.
https://imagizer.imageshack.com/img923/2572/8M6NRu.png
As you can see, I want to center the lock image and already have an account button to the get started button.

You can't center a pair-of-views. So you need another view that does nothing but contain the lower lock-and-button, and now you can center that in respect to the upper button.
This use of an effectively invisible view just to make the layout constraints work correctly is extremely common, so don't hesitate.
You will need to pin the lower lock-and-button on all four sides to their superview, the new view that I'm talking about, in order to size the new view to fit them. Then you position the new view and you're all set.
In the storyboard:
In the running app:

Related

Moving a label without having it nest under a screen filling UIView

I have a UIView implementing a GMSMapView which stretches to fill out the screen. I want a little label displaying text on top of this map on the top-right corner.
I managed to re-order the arrangement to successfully display it on top of the map while in the center:
But the moment I try to move it to another spot, it nests under Map Label and no longer shows up:
How can I prevent it nesting under the Map Label view?
First remove all constrains from the label, and then center the label in the middle of the View aligned perfectly. Then go to Resolve Auto Layout Issues and click Update Constrains after add Missing Constrains and run the app. Another way that I use stack the label and place in the middle and add the appropriate constrains. To add a Stack View select your label and click on the first icons horizontally placed on the PIN row.

How to create a translucent layer on click of button, which would slide up for iphone

Hi I want to create a layer of the type in the image below.
The layer (with Capture mode and Shutter speed) slides up when I click on the setting button.
I am unable to figure out what should I do do create something like this. Also want to have the similar translucency in the layer as well as in the buttons on it also.
On click on the same button again, the layer(with Capture mode and Shutter speed) disappears, leaving what was there on the screen before (the camera view and the lower bar with the camera capture button, and the two setting buttons)
Please any suggestions are much appreciated.
Thanks
Maybe you can create a UIView and place every button you need there, and place it below the screen size. then when you click the setting button you call core animation to move the view up, click setting again to move it down.

Zoom An Entire View Controller

I have an app im working on. The main view controller has a keypad ( like on a safe door). I want the user to tap on the numbers pad and i want the whole view to zoom in. This is not a UIImageView. I know how to zoom an image/imageView. I want to have a super small set of numbers/number pad, and a super small textfield, then when it zooms in, those two UI elements will be big. I would like to have this done via button press!
Thanks in advance. I have no code to provide! Sorry, And Thanks :D
One possibility is to just make an imageview, zoom this to your desired size, then hide it and "replace it" by the real number pad. To do that just have the number pad hidden at the beginning and visible, once the image view reaches its final size and disappears (just hide it then)
To the user it all looks as if the "number pad" will zoom - which is actually your image of the number pad.
Also to have only one View to hide/unhide just put your all your keys of the number pad and whatever else on one container view.
To get the image to be zoomed, just make a screenshot and cut out your zoomable image area with some kind of Photoshop tool.
By the way, I would expect your idea of a zooming number pad will surely be a nice animation in your app!

How to pull a view from one corner of the app?

I would like to create view that could be pulled from one corner to take full screen (like the iphone status bar that can be pulled from top).
Could you just give me an idea how to accomplish that.
Thanks
Put a small view into the corner of the screen that acts as your handle.
Add a UIPanGestureRecognizer to that view.
When the gesture recognizer's action method gets called, move the handle and the view you want to present according to the movement of the user's finger.
When the gesture ends (because the user has lifted their finger off the screen), decide whether the movement was large enough to bring in the new view or not (e.g. if the user dragged the view over >30% of the screen, you move it in, otherwise you move it back out).
Animate the view into its final position.

How can I specify where I want my UI elements to go on orientation change in Interface Builder?

Ok so I know this is a bit of a newbie question, but being that I am a newbie its ok! I have a view that I am trying to make orientation friendly in IB, and I am having some difficulties.
I have everything looking nice in portrait of course, but then when I go to landscape mode (by hitting that arrow in the top-right corner) everything gets all messed up.
Now, because of the way the view is laid out, I need to align 3 buttons along the bottom of an image view in portrait, and then in landscape, those three buttons need to be symmetrically aligned along the right side.
No combination of fiddling with those red arrows in the size inspector are rewarding me the results I am seeking. Is it possible to set up the buttons one way in one orientation in IB, and then on change, set them completely different?
I have looked all around for a useful IB tutorial, but haven't been able to find anything.
I know you want to do this in IB, but if you're willing to try it programmatically, then you can move things around pretty easily. For your buttons, just implement the setCenter method like this:
[myButton setCenter:CGPointMake(xCenter,yCenter)];
Otherwise, if you want to use the IB, use the Autosizing options. The arrows will stretch or compress the width and height, and the bars (|-|) preserve distances from the top and bottom. If you have three buttons in a row, you can fix the left distance for the left button, the right distance for the right button and both/neither for the center button. Something like that may work.
The third option is to make a new view, call it landscapeView or something, by dragging a UIView from the library to the window with File's Owner, First Responder, View, etc. Then orient that to landscape, copy over all your UI objects, lay them out as you like, and when you rotate, replace the current view with landscapeView. The problem with this that I've found (one of many) is that you have to reconnect everything and have different IBOutlets for the labels and whatnot. T
Using IB's autosizing features can only do so much. PengOne does a good job of describing them in his second paragraph. If they are not enough, you have to move the elements programmatically. See Responding to Orientation Changes. Otherwise, you can just use a completely different view, again as mentioned by PengOne.