iphone - example - uialertcontrollerstyleactionsheet




last Button of actionsheet does not get clicked (2)

I have used an actionsheet in my project and when it appears it show all buttons but last (4th) button does not responds to my click(only it's half part responds)..

I know the reason it is because i have used a TabBarController and the present class is inside that tabbar controller.... only that part of the actionsheet is responding which is above the tabs....and my last button is half above and half is on top of tabbar

please help


The real problem comes in, when your interface is rotated to landscape and the parent view controller has a transformation on it. Believe me, that's a realistic scenario, doh. Then the action sheet is clipped and you can't use the parentViewController because it is transformed. The solution to avoid all these issues is to create a new window, add a rotatable view controller as rootViewController and use its view to display the sheet.

CGRect applicationRect = [[UIScreen mainScreen] bounds];
UIWindow* actionSheetWindow = [[UIWindow alloc] initWithFrame:applicationRect];
RotationViewController* rootViewController = [[RotationViewController alloc] initWithNibName:nil bundle:nil];
actionSheetWindow.rootViewController = rootViewController;
[rootViewController release];
actionSheetWindow.hidden = NO;

UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle:nil];
[actionSheet setCancelButtonWithTitle:@"Cancel" handler:^{
    actionSheetWindow.hidden = YES;
    [actionSheetWindow release];
}];

[actionSheet showInView:rootViewController.view];

The code above uses BlocksKit, but you can do it also by using the actionSheet delegate and instance properties.

RotationViewController is just a UIViewController subclass that implements

- (void) viewDidLoad {
   [super viewDidLoad];
   self.view.backgroundColor = [UIColor clearColor];
   self.view.opaque = NO;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  return YES;
}

What method do you use to show your actionsheet. Try showFromTabBar: method





uiactionsheet