views:

262

answers:

2

Hello again, I'm putting together an app that uses a keyboard (like the native iPhone one) that has symbols on the keys. My question is how to I change the location of a button when it is clicked (as the UIControlStateHighlighted images is bigger than the regular state).

Thanks for any help/pointers.

A: 

All UIView instances have a frame, bounds, center, and transform properties. You can use any or all of these to manipulate your button. Changing the center may be all you need to do.

slf
Thanks for the response the centre attribute might just be what i need. Is there a simple if statement i can use to detect touches on a button? (Sorry for all the questions I'm from a .NET background so I'm spoiled a bit when it comes to finding built in classes there).
Gavin O'Brien
To detect touches, wire up your the TouchUpInside to an IBAction using Interface Builder. Lots of YouTube videos on how to use Interface Builder if you aren't familiar with it.
slf
A: 

Try this:

[yourView setFrame:CGRectMake(yourHorizontalPosition,yourVerticalPosition,[yourView.frame.size width],[yourView.frame.size height])];

Does that work for you?

Tim van Elsloo