具有许多按钮的Xcode iPad UIActionSheet不能正确显示iOS7

前端之家收集整理的这篇文章主要介绍了具有许多按钮的Xcode iPad UIActionSheet不能正确显示iOS7前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在iPad上,新的ios 7 UIActionSheet没有正确显示许多按钮.

不清理UIActionSheet的滚动背景.这些按钮似乎在背景UIActionSheet中冻结.

screenshot with problem

我的代码

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];
    }
}

基于这个答案:
Change Text color in UIActionSheet Buttons

原文链接:https://www.f2er.com/iOS/337709.html

猜你在找的iOS相关文章