views:

577

answers:

2

I am using a standard pop up action in my iphone app (the pop up at the bottom of the screen). This has 2 buttons "ok" and "cancel". It seems the standard colour scheme is to have the top button red. I want to change this so the top button is green. I have been googling forever and can't find the solution. Any ideas would be great. Thanks

A: 

You can browse through ActionSheet ( I assume you use UIActionSheet class) subviews - like that:

NSArray* subViews = [aSheet subviews];
for (UIView* sView in subViews)
{
    ...
}

And change subviews properties there as you like.

You can also create UIActionSheet without any buttons at all:

UIActionSheet* aSheet = [[UIActionSheet alloc] initWithTitle:@"\n\n\n" delegate:self cancelButtonTitle:nil  destructiveButtonTitle:nil otherButtonTitles:nil];

And afterward create your own custom buttons and add them to the ActionSheet view. (put more \n to the title to enlarge Sheet height)

Vladimir
A: 

I assume you're referring to a UIActionSheet. In a UIActionSheet, you can define a button that cancels the action and has a black background, a button that marks a destructive action and has a red background, and all other buttons which have white backgrounds. Which option corresponds to which class of actions can be specified in the initialization of the UIActionSheet using – initWithTitle:delegate:cancelButtonTitle:destructiveButtonTitle:otherButtonTitles:.

The design of a UIActionSheet, including why you should only use these colors for your buttons, is explained in the iPhone Human Interface Guidelines. I'd follow Apple's suggestions in this regard, as they will make your application easier to use.

Brad Larson