I have alertview where I have Yes and No options. It looks like below.
Code used is
UIAlertView *confAl = [[UIAlertView alloc] initWithTitle:@"" message:@"Are you sure?" delegate:self cancelButtonTitle:@"Yes" otherButtonTitles:@"No", nil];
confAl.tag = 888;
[confAl show];
This is perfect but I want Yes to be bold and No as normal font.
So I switched the Yes and No button and have like below.
Code used is
UIAlertView *confAl = [[UIAlertView alloc] initWithTitle:@"" message:@"Are you sure?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
confAl.tag = 888;
[confAl show];
Is there any way where we can have Yes as first button and No as second button with Yes as bold effect?
Note : I want same effects in iOS 6 (same old style) & iOS 7 (new style as above in image) too.
You may use
preferredAction
default property ofUIAlertController
instead ofUIAlertView
.setPreferredAction
will set your button title bold.Your requirement is to "Highlight" Yes button.. In iOS 7 by default cancel button is the one which is highlighted. Unfortunately you can't simply change alertViewStyle here. But you do have a workaround.
Look at this answer.