相关疑难解决方法(0)

更改UIActionSheet中项目的文本颜色 - iOS 8

我一直在使用以下代码来更改我添加的项目的文本颜色UIActionSheet.:

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
    for (UIView *subview in actionSheet.subviews) {
        if ([subview isKindOfClass:[UIButton class]]) {
            UIButton *button = (UIButton *)subview;
            [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

它工作正常iOS7,但在iOS8上面的代码中不会更改项目的文本颜色.

现在的问题是如何改变我在新增项目的文本颜色UIActionSheet使用iOS8

附加信息:
我添加了断点,以查看上述代码中的以下行是否被执行:

UIButton *button = (UIButton *)subview;
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)

这些行不会被执行.所以,if([subview isKindOfClass:[UIButton class]])总是false适用于所有项目actionSheet.subviews.所以我认为观点层次 UIActionSheet改变了.

uiactionsheet ios uiactionsheetdelegate ios8

35
推荐指数
5
解决办法
4万
查看次数

如何在UIActionSheet中自定义按钮?

我想改变image ofbuttonsUIActionSheet,我有images每个button了,我希望每个button显示image我想要的.我在网上搜索了我找到了很多答案,但是他们没有用.

这是初始化的 UIActionSheet

-(IBAction)showActionSheet:(id)sender {

    UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"title" delegate:self cancelButtonTitle:@"Cancel Button" destructiveButtonTitle:nil otherButtonTitles:@"Other Button 1", @"Other Button 2", nil];
    popupQuery.actionSheetStyle = UIActionSheetStyleDefault;
    [popupQuery showInView:self.view];
    [popupQuery release];

}
Run Code Online (Sandbox Code Playgroud)

iphone uiactionsheet ipad

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

uiactionsheet ×2

ios ×1

ios8 ×1

ipad ×1

iphone ×1

uiactionsheetdelegate ×1