Skip to content
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

native iOS button dialog bold selection #1

Closed
kismosis opened this issue Jan 3, 2016 · 3 comments
Closed

native iOS button dialog bold selection #1

kismosis opened this issue Jan 3, 2016 · 3 comments

Comments

@kismosis
Copy link

kismosis commented Jan 3, 2016

on 2 button dialog, button on left is always bold. if you typically use this for the cancel button it will be bold, which highlights the 'wrong' action you generally want the user to take. Can you make the bold button selectable? or leave the right button as the bold button (instead of flip it in the code which you do).

  • note this issue should have been posted on dialogs, not the app.
@TomGrill
Copy link
Owner

TomGrill commented Jan 3, 2016

You cannot change the bold button in the current version. What you can do is flipping as you mentioned.

I will create an feature issue on the project: TomGrill/gdx-dialogs#4

Thing is the current version uses deprecated classes and methods. So the replacements might not allow this feature. We will see when I have time for updating the code.

@kismosis
Copy link
Author

kismosis commented Jan 3, 2016

It doesn't help just flipping the strings on the buttons and tried quickly hacking the iOS 8 UIAlertController as a custom button by modifying the IOSGDXButtonDialog, but still couldn't get the bold to change. i did it like this;

    alertView = new UIAlertController(title, message, UIAlertControllerStyle.Alert);

            UIAlertAction defAction=new UIAlertAction((String)labels.get(0),UIAlertActionStyle.Cancel,new VoidBlock1<UIAlertAction>() {
                @Override
                public void invoke(UIAlertAction a) {
                    performClickOnButton(0);
                }
            });
            UIAlertAction defAction2=new UIAlertAction((String)labels.get(1),UIAlertActionStyle.Default,new VoidBlock1<UIAlertAction>() {
                @Override
                public void invoke(UIAlertAction a) {
                    performClickOnButton(1);
                }
            });

            alertView.addAction(defAction);
            alertView.addAction(defAction2);

and instead of show/hide:

    ((IOSApplication) Gdx.app).getUIWindow().getRootViewController().presentViewController(alertView, true, null);

    ((IOSApplication) Gdx.app).getUIWindow().getRootViewController().dismissViewController(true, null);

unfortunately, if you flip the UIAlertActionStyle.Cancel/Default in the actions, the buttons change position and alertView.setPreferredAction(action) doesn't seem to be bound.

After a bit of searching, seems like Apple don't really want you to change the bold/position of buttons. Looks like it is possible, but needs some customization work.

@cnnranderson
Copy link

To go into a bit more detail why this is necessary (More so for the fact of making sure the right button text is bold) is just to follow iOS design spec. The right option, typically closest to a user's thumb for right handed users, is the "safe" or "guided" option. It's not safe to assume that the cancel choice will always be on the left. Good example being: http://i.imgur.com/rlt89D1.png where the "guided" choice is cancel, because choosing settings can be considered "destructive" by leaving your app and changing a privacy setting.

https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Alerts.html

You'll see here how they describe the situation with two buttons.

The same can be said for dialogs on Android devices running Lollipop, given the material design spec.

@TomGrill TomGrill closed this as completed Jun 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants