2011-03-02 53 views
1

操作表显示第一次加载操作表时高度为20到30像素的空间。 当我第二次加载操作表时,它正确加载。 任何人都可以在这种情况下帮助我吗?操作单第一次加载屏幕底部的空间?


- (void)viewDidLoad { 
    [super viewDidLoad]; 
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:YES]; 
    [self loadImage:nil]; 
} 

当视图负载我打电话,其示出了在页面底部的空间上面的事件。


,当我从下面的函数它工作正常加载...

- (IBAction)loadImage:(id)sender { 
    if(!actionSheetAction) { 
     UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"" 
                   delegate:self 
                 cancelButtonTitle:@"Cancel"  
                destructiveButtonTitle:nil 
                 otherButtonTitles:@"Use Photo from Library", 
                      @"Take Photo with Camera", nil]; 
     actionSheet.actionSheetStyle = UIActionSheetStyleDefault; 
     actionSheetAction = ActionSheetToSelectTypeOfSource; 
     [actionSheet showInView:self.view]; 
     [actionSheet release]; 
    } 
} 
+0

最早能有人帮我解决这个问题吗? – breakfreehg 2011-03-02 12:52:27

+0

- (void)viewDidLoad {super viewDidLoad]; \t [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:YES]; \t [self loadImage:nil]; } 当视图加载时,我正在调用上述显示页面底部空间的事件。 – breakfreehg 2011-03-02 13:11:51

+0

;当我从下面的函数加载它,它工作正常... - (IBAction为)的LoadImage(ID)发送{ \t如果(actionSheetAction!){ \t \t UIActionSheet * actionSheet = [[UIActionSheet的alloc] initWithTitle :@ “” 委托:自我cancelButtonTitle:@ “取消” destructiveButtonTitle:无 \t \t \t \t \t \t \t \t \t \t \t \t \t \t otherButtonTitles:@ “使用资料库中的照片”,@ “带带摄像头的照片”,零]。 \t \t actionSheet.actionSheetStyle = UIActionSheetStyleDefault; \t \t actionSheetAction = ActionSheetToSelectTypeOfSource; \t \t [actionSheet showInView:self.view]; \t \t [actionSheet release]; \t} } – breakfreehg 2011-03-02 13:12:20

回答

0

当您设置状态栏或导航栏的风格与不透明的UIStatusBarStyleBlackOpaque风格(不知道它的名字完全一致)那么你的视图将从Y开始,如果没有不透明的其他风格的状态栏Y将是Y = 20,那么它的原点Y = 0。可能这会帮助你。而如果导航栏样式没有不透明,你的原点Y将是44,如果你设置了任何不透明的导航栏类型,那么YOur Y将为0(Y = 0)。 谢谢。

+0

之前viewdid加载我认为风格将是blackOpaque以外的其他吗? – Iducool 2011-03-03 05:54:58