views:

256

answers:

2

I have a UIActionSheet that pops up as soon as the initial view in my iPhone app loads if there is data that can be sync'd back to a web service. The trouble is that the UIActionSheet is popping up too high - exactly half the tab bar is exposed beneath the action sheet. I'm not aware that this is caused by styling? Can anyone offer an explanation/solution to prevent this happening?!

Thanks in advance for any suggestions, my code appears below...

- (void)viewDidLoad {

    //...preset a few values here, unrelated to the view...
    //...

    // Add an actionsheet to prompt for a DB sync
    if ([myDatabase isSyncPossible] == true) { 
        UIActionSheet *actionsheet = [[UIActionSheet alloc]
            initWithTitle: @"You have information that hasn't been uploaded, would you like to sync now?"
            delegate: self
            cancelButtonTitle: @"No thanks, maybe later"
            destructiveButtonTitle: @"Yes, upload now"
            otherButtonTitles: nil];
        actionsheet.tag = 2;
        [actionsheet showInView:self.view];
        [actionsheet release];
    } 
}
A: 

For the showInView: call, try using the navigation view or tab bar view instead of your controller's view.

Kristopher Johnson
A: 

Assuming I understand your description properly, it sounds like the frame of 'self.view' doesn't run all the way under the tab bar but instead just goes halfway. Since the action sheet draws from the bottom of the view it will start from wherever that view does. To fix make the 'self.view.frame' go to the bottom of the screen.

A screen shot would help.

TechZen
Thanks for both answers and taking the time to help me!The view size was indeed wrong, not sure why this wasn't obvious in the interface, but correcting it has indeed solved the problem. Thanks very much!
Purpletoucan