UIActionSheet button's color

后端 未结 5 992
失恋的感觉
失恋的感觉 2020-11-29 06:27

How can I change the color of UIActionSheet button\'s color?

5条回答
  •  鱼传尺愫
    2020-11-29 06:38

    You can easily achieve it by using following code

    Apple UIActionSheetDelegate protocol documentation

    https://developer.apple.com/library/ios/documentation/uikit/reference/UIModalViewDelegate_Protocol/UIActionSheetDelegate/UIActionSheetDelegate.html

    - (void)willPresentActionSheet:(UIActionSheet *)actionSheet 
    {
        for (UIView *_currentView in actionSheet.subviews) 
        {
            if ([_currentView isKindOfClass:[UIButton class]]) 
            {    
                UIButton *button = (UIButton *)_currentView;
                [button setTitleColor:YOUR_COLOR forState:UIControlStateNormal];
            }
        }
    }
    

提交回复
热议问题