Pinch to grow/shrink the size of a button - iphone

I've a few button on my screen which can be moved around ok, but I was wondering has anybody ever implemented a pinch gesture on a button to shink and grow the button?
If anybody has any ideas/help/examples of implementing this kind of functionality it would be greatly appreciated.

I'd add a UIPinchGestureRecogniser to the button, and then apply it's scale property as a transform on the button's frame.
I don't have sample code, but that is the area I would look at to accomplish this.

Related

How can I Know the force of a swipe Gesture Recognizers?

I want to move a image to the right or to the left with the swipe gesture recognizer, i´m already moving the image using the CCMoveTo function, but I don´t know how move the image faster or slower depends of the force of the swipe.
If the user make a strong swipe the image should move faster than if the user make a soft swipe.
Anyone have any advice?
A UISwipeGestureRecognizer is a one shot thing. It fires when the device detects the gesture and is done after that.
If you want more information about the movement of the finger you should check UIPanGestureRecognizer.
That's what the property velocity in the UIPanGestureRecognizer is for. You can see an example of how to use it in class 08 (I think) of cs193p by Paul Hegarty. Here's the link to download it from iTunes U

Animating an UIButton on an UIScrollView

I'm having problems animating my button in my scrollview. Basically what I'm doing is moving the button down the y-axis when the button is pressed down and moving it back to it's original position once the press has stopped. My code itself works just fine and does exactly what it is meant to do. Oddly enough, it only does so on a regular View. On a scrollView, it only moves it down after a short delay after it is pressed and the animation is very choppy. I know that there's nothing wrong with my code and that's why I'm so confused. Does anybody have an idea on how to fix this? Any help would be greatly appreciated!
Not sure how to make what you want work, but I am pretty sure the "choppy" behaviour is a result of the UIScrollView touch being recognized and activating what it is meant to activate (i.e pan gesture). One idea that comes to mind is to disable scrolling when this action is performed.

Looking for direction for a Custom Gesture like swipe to scroll

I'm trying to have a sort of gesture that will seamlessly switch between a group of images this part I have sorted. The part that is catching me up is the gesture to do so and how I might introduce acceleration.
Basically the user would swipe as normal and after the swipe is registered it would change the image displayed and the faster once swiped the faster the image would change ideally it would then keep that speed until the users finger was lifted leaving the possibility to just scroll repeatedly through the images.
Any direction someone could give me would be great.
Thanks.
Assuming you would be using a UIScrollView for this, setting the scrollView.decelerationRate property would allow you to manipulate the deceleration rate/scroll speed. To calculate the "swipe speed", take a look here: Detecting Special touch on the iphone for some pointers.

How can I do this iPhone (segmentedcontrol?) layout?

Please look at this screenshot:
When you tap in another segmentedcontrol, it switches smoothly (try it if you can).
First of all, is it a segmentedcontrol?
Second, how can I add this smooth effect?
Thanks guys.
I just tried. It does not seem to be a segment view.
Maybe 3 dark buttons(or view or views) and a layer that moves and overlay the current selected button.
Everything is well crafted so it looks great ;)
I think I could do that with a big UIImageView (instead of the three buttons) with an UITapGestureRecognizer to get the touch and a CALayer for the selected button

How does iPhone draw controller?

I'm a newbie in iPhone development and now encounter a problem:
I want to add a small hotspot on a large image and simply came up with the idea that I can add a button in that area setting alpha 0 to hide the button. Unfortunately, the phone does not response click events any more. Instead, if I increase the alpha, I can receive click events without any problems. So I wonder in which order does iPhone draw controller on the screen. Is it because my background image is drawn after the button if I set alpha of button too low, so the click event is intercepted by the background image?
Any hints will be highly appreciated. Thank you all in advance!
Best Regards.
Set the button's style to Custom; the button will not be drawn, but should remain fully active.
The problem is not the order in which the views are drawn, it's rather that if a view's alpha is 0 it does not receive touch events. it's like the view is not there at all.
but you don't have to set the alpha to 0 on the UIButton, you can simply make it a Custom button instead of a Rounded Rect button. it'll be invisible and still work.