UIActionView display wrongly
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 UI开发者_运维技巧ActionSheet 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];
}
}
For the showInView:
call, try using the navigation view or tab bar view instead of your controller's view.
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.
精彩评论