I have created Uibutton programmatically as grid in scrollview.Now I need to drag and drop the UIbutton title to another button.But the original button title should remain same.I searched stackoverflow I found option to drag original button or label to new position.Please anybody help me to fix this . Thanks
int x=0;
int y = 20;
for (int i=0; i<20; i++) //20 = total button
{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setTitle:@"TEXT" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(dragOut:withEvent:)forControlEvents:UIControlEventTouchDragOutside |UIControlEventTouchDragInside];
btn.frame = CGRectMake(10+x,y, 100, 100);
x=x+70;
[self.scrollView addSubview:btn];
if((i+1)%4==0)//4 means how many buttons you need for a row
{
y+=110;
x=0;
}
}
[self.scrollView setContentSize:CGSizeMake(300, y)];