views:

18

answers:

2

I want to add to my application a new view with buttons for sharing content or saving it to disk. I know how to do sharing itself (save, email), but I wonder if this layer should be created as frame or there is any ready-to-use class displaying modal ![alt text][1]layer for half screen?

I prefer to ask before doing it manually. I'm not sure if frame is only method of displaying this for half screen size, or maybe I should display transparent layer and add only non-transparent rect with buttons for half screen?

I'm not able to add pictures yet, so I put example on my website: http://iphone.orpi.pl/?p=31

+1  A: 

Hi, looking at the picture on your link, it's clear you're talking about an Action Sheet.

This is how you initialise & display one:

UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:@"My Title"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Go"
otherButtonTitles:@"Remind me Later",nil];

If you want to track clicks on the button, you must set the delegate (as above), and the delegate must conform to the UIActionSheetDelegate protocol (set in the h file).

The event that you then override for handling the button taps is

- (void)actionSheet:(UIActionSheet *)actionSheet
                            clickedButtonAtIndex:(NSInteger)buttonIndex {
    //code
}
h4xxr
thank you. Hint for others - it is described in iPhones Human Interface Guidelines
plusz
Hint for you - accept my answer then! ;)
h4xxr
sure - I learned new featyre of stackoverflow :)
plusz
A: 

I think, that one or two more lines may be helpful for other people to display sheet:

[sheet showInView:self.view];
[sheet release];

and one more hint to change astionsheet style

popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;

plusz