Presenting action sheet clipped by its superview

转自: http://dongxin1390008.blog.163.com/blog/static/3179247820129148363384/

 

Presenting action sheet clipped by its superview.Some controls might not respond to touches.On iPhone try-[UIActionSheet showFromTabBar:]or-[UIActionSheet showFromToolbar:] instead of -[UIActionSheet showInView:].

今天学UIActionSheet的时候,调试的时候,突然显示这个警告,在stackoverflow上找到这个答案:http://stackoverflow.com/questions/4447563/last-button-of-actionsheet-does-not-get-clicked

 
在模拟器里面测试的时候,发现最下面一个按钮点击的时候,不是很好点击了,而且也出现了一大堆警告,这个博客上写出了答案: http://dale.leepood.com/2012/04/
 
我的代码是这样写的:

 

UIBarButtonItem*setStyleButton=[[UIBarButtonItemalloc]initWithTitle:@"Style" 

 
  

                                                                     style:UIBarButtonItemStyleBorderedtarget:self 

 
  

                                                                    action:@selector(setNavigationControllerStyle:)];

 

-(void)setNavigationControllerStyle:(id)sender

 
  

{

 
  

  //more code

    //[styleAlert showInView:self.view];

 
  

    [styleAlert showInView:[UIApplicationsharedApplication].keyWindow];

[styleAlert release];

 
  

}

将代码: [styleAlert showInView:self.view]; 改为: [styleAlert showInView :[ UIApplication sharedApplication ]. keyWindow ];即可

你可能感兴趣的:(action)