I want to create a UIButton that moves random on screen after pressed it. I want to use the animation with blocks. How do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try this, it’s a simple example which will animate your button 50 px to the right then back again (don’t forget to link myButton in IB) –
.h –
.m –
You can put whatever animations you like in the blocks.
You might want to think about getting rid of the UIViewAnimationOptionAllowUserInteraction bits as there could be some amusing results if the user kept touching the button during the animation…