Code Monkey home page Code Monkey logo

Comments (16)

skywinder avatar skywinder commented on June 3, 2024

Hi. There is no support to choose tint color yet.

from actionsheetpicker-3.0.

skywinder avatar skywinder commented on June 3, 2024

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.

rustanacexd avatar rustanacexd commented on June 3, 2024

+1 yeah this is a must have feature I think

from actionsheetpicker-3.0.

jruston avatar jruston commented on June 3, 2024

Also would very much appreciate this.

from actionsheetpicker-3.0.

skywinder avatar skywinder commented on June 3, 2024

@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.

tobedev avatar tobedev commented on June 3, 2024

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.

kivannc avatar kivannc commented on June 3, 2024

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.

tbaranes avatar tbaranes commented on June 3, 2024

+1, I'd love to have this feature too without to have override the native buttons.

from actionsheetpicker-3.0.

zerodiff avatar zerodiff commented on June 3, 2024

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.

ghysrc avatar ghysrc commented on June 3, 2024

+1, I was just told to change the tint color.

from actionsheetpicker-3.0.

mathieudebrito avatar mathieudebrito commented on June 3, 2024

+1

from actionsheetpicker-3.0.

Maxatma avatar Maxatma commented on June 3, 2024

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.

hanishassim avatar hanishassim commented on June 3, 2024

+1

from actionsheetpicker-3.0.

skywinder avatar skywinder commented on June 3, 2024

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.

mikecole20 avatar mikecole20 commented on June 3, 2024

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 UIBarButtonItems ask for a target and action (a selector).

from actionsheetpicker-3.0.

tbaranes avatar tbaranes commented on June 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.