-
-
Notifications
You must be signed in to change notification settings - Fork 740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change tint color / font color of Done / Cancel buttons #54
Comments
Hi. There is no support to choose tint color yet. |
If you want to set custom tint color for buttons - you can implement your own buttons and replace default buttons with your own by methods: |
+1 yeah this is a must have feature I think |
Also would very much appreciate this. |
@rustanacexd , @jrustonapps ok, I reopen this issue, since there is at least 3 person mention about this.. I can't promise, that I will implement it in near future, but I'm open for a pull requests and you can implement this feature by yourself also. (as I mention above by methods: |
A working workaround you can use is to set a tint color to the main window that hosts the actionpicker, in the SWActionSheet.m file as follows: - (UIWindow *)window
{
if ( SWActionSheetWindow )
{
return SWActionSheetWindow;
}
else
{
return SWActionSheetWindow = ({
UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
window.windowLevel = UIWindowLevelAlert;
window.backgroundColor = [UIColor clearColor];
// Window Tint Color.
[window setTintColor:[UIColor whatEverColor]];
window.rootViewController = [SWActionSheetVC new];
window;
});
}
} PS. This will set the tint color of the default buttons in every single instance of actionsheetpicker in your project. |
You can set the color for a single button by using setTitleTextAttiributes. Here is the example UIBarButtonItem *barButtonNext1 = [[UIBarButtonItem alloc]
initWithTitle:NSLocalizedString(@"Next", nil)
style:UIBarButtonItemStylePlain
target:self
action:@selector(genderNextTapped:element:)];
[barButtonNext1 setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blackColor]} forState:UIControlStateNormal];
[self.pickerGender setDoneButton:barButtonNext1]; |
+1, I'd love to have this feature too without to have override the native buttons. |
For what it's worth, another workaround is to override this method from
This will keep the default button behavior but change the styles. Of course, you could also make a property of your subclass, etc. I know people are all about composition over inheritance, but hackers gotta hack. In any case, this a very useful library and saves a lot of time. |
+1, I was just told to change the tint color. |
+1 |
ActionSheetStringPicker does not conform to the UIAppearanceContainer protocol |
+1 |
Hooray, guys! Please welcome version |
It would still be nice to set the font without having to override the button completely. If you do provide a custom button, do the |
Yes, you don't have to set a selector to your custom |
I'd like to change the font color of the text on the picker "Cancel" and "Done" buttons. How can they be changed directly.
My application typically has black menus with white text on the menu.
I'm calling the following:
I do have a workaround by calling this line of code, but it causes havoc elsewhere inside my app. i end up putting this in multiple locations and switching the UIColor to do it.
I'd be fine with changing the background color as an alternative.
The text was updated successfully, but these errors were encountered: