在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];
解决方法
这是我的actionSheet代理的解决方法:
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet { actionSheet.backgroundColor = [UIColor whiteColor]; for (UIView *subview in actionSheet.subviews) { subview.backgroundColor = [UIColor whiteColor]; } }