带有许多按钮的Xcode iPad UIActionSheet无法正确显示iOS7

Con*_*nus 15 uiactionsheet ipad ios7

在iPad上,新的ios 7 UIActionSheet没有正确显示,有很多按钮.

在滚动时不清除UIActionSheet的背景.按钮似乎在后台UIActionSheet中冻结.

有问题的截图

我的代码:

UIActionSheet *popupQuery = [[UIActionSheet alloc]; 
for (int i=0; i<[ParamAllList count]; i++) 
{ 
    NSMutableDictionary *Param = [ParamAllList objectAtIndex:i]; 
    [popupQuery addButtonWithTitle:[Param valueForKey:@"name"]]; 
    [[[popupQuery valueForKey:@"_buttons"] objectAtIndex:[[popupQuery valueForKey:@"_buttons"] count]-1] setImage:[UIImage imageNamed:@"add40icon.png"] forState:UIControlStateNormal];
} 
popupQuery.actionSheetStyle = UIActionSheetStyleAutomatic; 
[popupQuery showFromRect:Button_Settings.frame inView:Button_Settings.superview animated:YES];
Run Code Online (Sandbox Code Playgroud)

小智 24

这是我对actionSheet委托的解决方法:

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
    actionSheet.backgroundColor = [UIColor whiteColor];
    for (UIView *subview in actionSheet.subviews) {
        subview.backgroundColor = [UIColor whiteColor];
    }
}
Run Code Online (Sandbox Code Playgroud)

基于以下答案: 在UIActionSheet按钮中更改文本颜色

  • - (void)willPresentActionSheet:(UIActionSheet*)actionSheet {int count = 0; for(UIView*object in actionSheet.subviews){if([[[object class] description] isEqualToString:@"UIView"]){count ++; if(count == 2){object.backgroundColor = [UIColor whiteColor]; 打破; }}}} (2认同)
  • 好的工作,这样的问题存在是一种耻辱.谢谢. (2认同)