tags:

views:

800

answers:

3

I have a UIActionSheet that I set up like this:

-(void)trash:(id)sender
{
UIActionSheet *sheet = [[[UIActionSheet alloc] initWithTitle:@"Delete" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Remove text" otherButtonTitles:@"Remove tags", nil] autorelease];

[sheet showInView:self.view];

}

The sheet appears from the bottom of the screen, as intended, and all correct. However none of the buttons are active. The only way out is to touch the Home button.

Is there something I am missing?

The view self.view is the view of the view controller. The only odd thing about it is that it is less than the full screen height because it sits above the keyboard.

// Never called
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex;
{
    NSLog(@"%d",buttonIndex);
}

// Never called
- (void)actionSheet:(UIActionSheet *)actionSheet     didDismissWithButtonIndex:(NSInteger)buttonInde
{

}

// Never called
- (void)actionSheet:(UIActionSheet *)actionSheet     willDismissWithButtonIndex:(NSInteger)buttonIndex
{

}

// Called if I hit Home button
- (void)actionSheetCancel:(UIActionSheet *)actionSheet
{

}


// Called second
- (void)didPresentActionSheet:(UIActionSheet *)actionSheet
{

}

// Called first
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet
{

}
A: 

Double-check the firstResponder status.

Kailoa Kadano
+1  A: 

If there is a keyboard on the view, chances are the textfield/textview for which the keyboard is visible is the first responder. For any control to respond to touches, it has to be the first responder.

Make sure that your action sheet is the first responder when you display it.

lostInTransit
A: 

You need to show your view not in self.vew but in Appdelegate's root view.

Use [appDelegate.window.subviews objectAtIndex:0];

I have this method in AppDelegate:

-(UIView *) getRootView {
return [self.window.subviews objectAtIndex:0];

}

Rod