I have added a UIScrollVIew using IB. Then using the following code i add a few buttons to this UIScrollView.
for (int index=0; index<3;index++)
{
UIButton* button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:buttonTitle forState:UIControlStateNormal];
[button setFrame:CGRectMake(18,200,300,45)];
[button setTag:100+index];
[button addTarget:self action:@selector(butclick:) forControlEvents:UIControlEventTouchUpInside];
[self.scrollView addSubview:button];
}
Now i need a way to remove these buttons which i added from the ScrollView.
note: There are other buttons, images, labels attached to the UIScrollView. And those should not be removed. It’s only the buttons that i added programatically should get removed from the UIScrollView.
Put a tag on those buttons, then you can take them again using:
Or save those buttons in an array, and then you can do the same.
And if you just want to hide them, you can do: