I want to have a Mutablearray, have a list of three UIButtons in the array, randomly select one, and create a CGPoint that will help me move the imageView to its new point. Once that random button is chosen and sent to the point (50, 100) after that the random object that was moved should be removed from the array here's what i got so far :
h. file
m. file
as you can see i need to be able to point the the random object from the array and set it to that point, (50, 100)
h. file
Code:
UIButton*button1;
UIButton*button2;
UIButton*button3;
NSMutableArray *array;
@property.....
@property.....
@property.....
-(IBAction)buttonPressed;
m. file
Code:
-(void)viewDidLoad {
array = [[NSMutableArray alloc] initWithObjects: button1, button2, button3,nil];
}
-(IBAction)buttonPressed {
[[array objectAtIndex: (random() % [array count]) ?????????];
CGPoint point1 = **RANDOM UIButton FROM ARRAY**.center;
point1.x = 50;
point1.y = 100;
**RANDOM UIButton FROM ARRAY**.center = point1;
as you can see i need to be able to point the the random object from the array and set it to that point, (50, 100)