Tutorial details

Moving Objects | App Code for Sale | Preview

Moving Objects | iOS Tutorial

How to Move Objects

Overview PAGE TOP

Reference: http://www.geekylemon.com/xcode-moving-objects

In this tutorial i will be showing you how to Move Objects

Features:

  • 5 buttons

Moving objects is great and you can create some really awesome games that revolve around moving stuff you can even use this to reveal hidden content

ViewController.h PAGE TOP

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController {
IBOutlet UIButton *ButtonMove;
}
- (IBAction)Button1;
- (IBAction)Button2;
- (IBAction)Button3;
- (IBAction)Button4;
@end

ViewController.m PAGE TOP

@implementation ViewController

- (IBAction)Button1 {
CGRect frame = ButtonMove.frame;
frame.origin.x = 32;
frame.origin.y = 71;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
ButtonMove.frame = frame;
[UIView commitAnimations];
}

- (IBAction)Button2 {
CGRect frame = ButtonMove.frame;
frame.origin.x = 98;
frame.origin.y = 71;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
ButtonMove.frame = frame;
[UIView commitAnimations];
}

- (IBAction)Button3 {
CGRect frame = ButtonMove.frame;
frame.origin.x = 164;
frame.origin.y = 71;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
ButtonMove.frame = frame;
[UIView commitAnimations];
}

- (IBAction)Button4 {
CGRect frame = ButtonMove.frame;
frame.origin.x = 230;
frame.origin.y = 71;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
ButtonMove.frame = frame;
[UIView commitAnimations];
}
@end

Reference PAGE TOP

http://www.geekylemon.com/xcode-moving-objects

0 Comments Leave a comment

Please login in order to leave a comment.

Newest first
!

Sign-in to your Chupamobile Account.

The Easiest way to Launch your next App or Game.

Join Chupamobile and get instant access to thousands of ready made App and Game Templates.

Creating an account means you’re okay with Chupamobile’s Terms of Service and Privacy Policy.