I have a UIActionsheetClass which I am able to manipulate using the below code:

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
NSLog(@"action sheet %@", actionSheet.subviews);
for (UIView *subview in actionSheet.subviews) {

    if ([subview isKindOfClass:[UIButton class]]) {
        UIButton *button = (UIButton *)subview;
        [button setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
        [button.titleLabel setFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:20]];

    }
}
}

This code is currently working great however when testing on a 3.5" screen I have noticed that the Actionsheet does not take any of this styling. I have nailed it down only occurring when the list of actions requires a scroll view to deal with the buttons.

Do I have to access the scrollView inside of the ActionView subclasses in order to make the UIButton Styling?

有帮助吗?

解决方案

please look at my child class UICustomActionSheet. I've just pushed the latest changes, which allow to display styling correctly for iOs6 and iOs7 design. https://github.com/gloomcore/UICustomActionSheet

You can set the colors, fonts, text colors and also images for each buttons. Works fine both for iPhone and iPad. And also situation when buttons scrolling is also working fine. You can find my solution for this;-)))

Component is absolutely safety for Appstore so you can use it in your applications. Enjoy!

其他提示

You can loop through the action sheet's subviews to find a scrollview subclass. This will not get your app rejected.

However, I would not recommend this type of behavior. Apple recently nerfed this approach to UIAlertView in iOS 7 (they no longer actually put the alert view on the screen - a different view is used).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top