I have some values of UIButtons. Every button I have created dynamically, by this code:
-(void)AddNewTable: (NSString *) tablePic: (NSString *) addedType {
CreatedTable *ct = [[CreatedTable alloc] init];
CFUUIDRef newUniqueId = CFUUIDCreate(kCFAllocatorDefault);
NSString * uuidString = (__bridge NSString*)CFUUIDCreateString(kCFAllocatorDefault, newUniqueId);
CFRelease(newUniqueId);
UIImage *tableImage = [UIImage imageNamed: tablePic];
CGRect frameBtn = CGRectMake(160.0f, 160.0f, tableImage.size.width, tableImage.size.height);
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage: tableImage forState:UIControlStateNormal];
[button setFrame:frameBtn];
[button addTarget:self action:@selector (draggedOut:withEvent::) forControlEvents:UIControlEventTouchDragInside];
[button setTitle: [NSString stringWithFormat:@"%d", tables.count] forState: UIControlStateNormal];
ct.Id = [uuidString lowercaseString];
ct.posX = 160;
ct.posY = 160;
ct.isActive = true;
ct.Index = button.titleLabel.text;
ct.picture = [NSString stringWithFormat:@"tables/%@", tablePic];
ct.type = addedType;
ct.angle = 0.0;
[tables addObject:ct];
[hallView addSubview:button];
}
CreatedTable - is NSObject with string params of created buttons.
As you can see, I'm adding selector for every created button. I can move every button by this selector. Here is it's code:
- (IBAction)draggedOut: (id)sender withEvent: (UIEvent *) event: (NSSet *)touches {
CreatedTable = [tables objectAtIndex: selected.[titleLabel.text intValue]]
UIButton *selected = (UIButton *)sender;
selected.center = [[[event allTouches] anyObject] locationInView:hallView];
ct.posX = selected.center.x;
ct.posY = selected.center.y; // Here I'm changing params in ct.
}
Now I need to realize multi-select (select some value of buttons by tapping on them, to make some king of a group) and after that I need to move this group (all selected buttons) like one single object.
Any suggestions how to realize it?