Change Text Color of Items in UIActionSheet - iOS 8

前端 未结 9 1411
星月不相逢
星月不相逢 2020-11-29 02:26

I had been using following code to change text color of items which I add in UIActionSheet.:

- (void)willPresentActionSheet:(UIActionSheet *)act         


        
9条回答
  •  爱一瞬间的悲伤
    2020-11-29 03:09

    Ok, I ran into the same problem but I think I have found a solution:

    The appropriate way should be like this and I guess it works in iOS7:

    [[UIButton appearanceWhenContainedIn:[UIActionSheet class], nil] setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    

    But it will not work in iOS8 due to the fact that the ActionSheets "buttons" is now based on a UICollectionView. So after some digging around I got this to work instead:

    [[UICollectionView appearanceWhenContainedIn:[UIAlertController class], nil] setTintColor:[UIColor blueColor]];
    

提交回复
热议问题