UIActionSheet距离屏幕底部太远了

时间:2013-07-29 17:23:10

标签: ios uiactionsheet

因此,出于某种原因,我刚刚添加了一个动作表,它就会出现并停在屏幕底部之上。有没有办法手动告诉这里停止?

- (void)showActionSheet:(UIButton *)standardButton{
    UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel Button" destructiveButtonTitle:nil otherButtonTitles:@"Choose From Library", @"Take Photo", nil];
    popupQuery.actionSheetStyle = UIActionSheetStyleAutomatic;
    [popupQuery showInView:self];
}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (buttonIndex == 0) {
        // Choose from library tapped
        NSLog(@"Choose");
    } else if (buttonIndex == 1) {
        // Take a photo tapped
        NSLog(@"Take");
    } 
}

enter image description here

1 个答案:

答案 0 :(得分:1)

尝试使用self.view代替self