Comments (16)
Hi. There is no support to choose tint color yet.
from actionsheetpicker-3.0.
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: setCancelButton:
and setDoneButton:
from actionsheetpicker-3.0.
+1 yeah this is a must have feature I think
from actionsheetpicker-3.0.
Also would very much appreciate this.
from actionsheetpicker-3.0.
@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: setCancelButton:
and setDoneButton:
)
from actionsheetpicker-3.0.
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.
from actionsheetpicker-3.0.
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];
from actionsheetpicker-3.0.
+1, I'd love to have this feature too without to have override the native buttons.
from actionsheetpicker-3.0.
For what it's worth, another workaround is to override this method from AbstractActionSheetPicker
in whatever subclass of a subclass you can create to set whatever color you want:
- (UIBarButtonItem *)createButtonWithType:(UIBarButtonSystemItem)type target:(id)target action:(SEL)buttonAction
{
UIBarButtonItem *barButton = [super createButtonWithType:type target:target action:buttonAction];
barButton.tintColor = [UIColor whiteColor];
return barButton;
}
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.
from actionsheetpicker-3.0.
+1, I was just told to change the tint color.
from actionsheetpicker-3.0.
+1
from actionsheetpicker-3.0.
ActionSheetStringPicker does not conform to the UIAppearanceContainer protocol
+1 would be nice have this protocol to set same colours for all pickers in app
from actionsheetpicker-3.0.
+1
from actionsheetpicker-3.0.
Hooray, guys! Please welcome version 2.2.0
. Now you can use toolbarButtonsColor
to easily setup color of toolbar buttons! As well as toolbarBackgroundColor
property to setup background color! 🎉
from actionsheetpicker-3.0.
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 doneBlock
and cancel
closures still get called? I ask because UIBarButtonItem
s ask for a target and action (a selector).
from actionsheetpicker-3.0.
Yes, you don't have to set a selector to your custom UIBarButtonItem
if you have a doneBlock
set
(same for cancel). The block will be called.
from actionsheetpicker-3.0.
Related Issues (20)
- cancel block not called if user taps outside action sheet HOT 22
- SWActionSheetVC.dismissTap prevents calendar from working in inline style
- OK Button Locale not change HOT 3
- Current date is not available on compact Date picker style iOS 14.4 & above HOT 1
- Exclude days or dates
- "exported: true has no effect in '_specialize' attribute" Issue at Xcode 12.5 HOT 3
- Not working with Swift Package Manager [bug] HOT 5
- Remove the pieces of the code for less than the Deployment Target HOT 3
- Picker not showing on iPad but only on iPhone HOT 1
- Picker not appearing if try to show back to back
- ActionSheet opens in wrong display when iphone is connected to an external display.
- Mac Catalyst Warnings HOT 1
- SPM Issues HOT 1
- Adjust Picker Width HOT 2
- Unable to build archieve on Xcode 14.3 HOT 11
- date selection error
- selectedDate for .countDownTimer not working as expected
- Need secrets.COCOAPODS_TRUNK_TOKEN HOT 5
- Privacy manifest required by Apple HOT 3
- Error in v2.7.3 compilation issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from actionsheetpicker-3.0.