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!
Related
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:
I need some help figuring this out.
I have a simple UI I need to implement. I have 4 buttons that take up the entire screen and with the scrollview, I want the user to be able to scroll to make the 5th button visible. I know how to use auto layout to make my first four buttons display how I want them. The first button is 40% of the visible screen, the second button is 15%, the third 30% and the last button is 15% of the visible screen. The 5th button should be hidden but then revealed when the user scrolls down.
(To clarify, all buttons have width equal to their superview, proportional height to the superview and all buttons have no spacing between each other)
This is where I am stuck. I want the proportions as I stated above, but also want the 5th button to show when scrolled to, possibly at 10% of the now visible screen (with the first button now not showing itself fully). Is there a way to do this?
You can set the contentSize of the UIScrollView to be larger than the visible screen. The buttons can be sized and placed in a way to have all 5 buttons visible (with the 5th button actually off screen). The scrollView will bring the 5th button into view when scrolling.
I worked up a simple prototype using just a storyboard (and setting the contentSize of the scrollview in Runtime Attributes section, but this could be done in code if you need to pragmatically determine the button sizes.
I have a UISCrollview. Inside this scroller I have a picture and over the picture I have some objects (as subviews of the picture), like layers in a Photoshop composition. So, if I zoom the picture, the objects will zoom. If I scroll the picture, the objects scroll.
Now consider this: I have the picture zoomed in. The picture is now larger than the iPad screen. I am seeing the top half of the picture. I touch an object that is over the picture and start dragging it to the bottom of the screen. My intent is to drop the dragged object at the bottom of the picture, but as the picture is zoomed in, I have to drag the element to bottom of the screen, release it, scroll the picture up and then continue dragging the object.
What I want is this: I start dragging and when I arrive at the boundary of the screen, the scroller starts scrolling automatically showing parts of the image that were down or up.
What do I need is to know the rect that is visible, a kind of inverse of scrollRectToVisible...
Considering that the picture can be zoomed at any level, how do I know if the element I am dragging is near the border. BTW, how do I know what part of the scroller is being shown, even if it is zoomed?
thanks.
The visible rectangle has a size of scrollView.bounds.size and an origin of scrollView.contentOffset, in the coordinate space of the scrollview. Depending on what exactly you are doing, you may need to use convertRect:fromView: or convertRect:toView: to convert it into the coordinate space of the zoomed view.
Like in MS paint when we want to select portion of image we select rectangular box & drag over the image by click & holding left mouse key till the desired location.
How can we do the same functionality in iphone.
Plz help....
You can use multitouch in an image view and touch two points to mark the corners of the selection rectangle. You can then drag both fingers around to change the selection rectangle, and lock the selection when you lift one or both fingers.
Another alternative is to put the image in a scrollview. Then zoom and pan the subview around inside the scrollview until the portion that just fits the full scrollview represents the selection. You can put the control buttons outside the scrollview, or have them fade out and fade back in after some amount of time after the user has stopped moving the selection around.
I have a scrollview that has a number of custom imageviews in it. I use the custom imageviews as I need to be able to drag any one of them off the scrollview and to another location on the iPad screen, bit like a photo picker.
Problem is if I want to scroll the scroll view most of the time the custom imageview gets the touch and moves rather than the desired scroll?
I notice in the sample code from Apple using the autoscroll example that they have the same issue but they have left a large gap between the images....ugly!
Is there a way to let the app know when you want the touch to be a scroll and when to be a drag?
Thanks
You could make a drag require holding for 1 second, similar to the behavior of the home screen when in editing mode: if you want to scroll, you just flick; if you want to drag, hold down for a moment until the icon enlarges, then you can move it.