Clear the cached UIActionSheet and cache the uiactionsheet.
Click anywhere and a prompt is displayed:
Code:
// Click anywhere to see the sheet
-(Void) touchesBegan :( NSSet *) touches withEvent :( UIEvent *) event
{
UIActionSheet * sheet = [[UIActionSheet alloc] initWithTitle: @ "are you sure you want to clear the image cache? "Delegate: self cancelButtonTitle: @" cancel "destructiveButtonTitle: @" OK "otherButtonTitles: nil, nil];
[Sheet showInView: self. view];
}
How can I dynamically add buttons to UIActionSheet on the iPhone?
Let's take a look at this code: UIActionSheet * sheet = [[UIActionSheet alloc] init]; [sheet addButtonWithTitle: @ "Button 1"]; if (useDestructiveButton) {[sheet setDestructiveButtonIndex: [sheet addButtonWithTitle: @ "Button 2"];}
How to change the background color of UIActionSheet?
UIImageView * buttonbackgroundView = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "login_background"];
[UIActionSheet addSubview: buttonbackgroundView];
You can add images or change colors as needed.