RGriffiths
RGriffiths

Reputation: 5970

Buttons on UIAlertView

I have an app in which I want to make the user make a judgement from 1 - 4. I am using a UIAlertView:

UIAlertView *alert = [[UIAlertView alloc]initWithTitle: @"Judgment" message:@"Please choose your overall judgement." delegate: self cancelButtonTitle:nil otherButtonTitles:@"1",  @"2", @"3", @"4", nil];

Although it works the view looks like the one shown below, with the number 4 where the Cancel button usually is. Is there a better way of doing this?

enter image description here

Upvotes: 1

Views: 123

Answers (3)

scollaco
scollaco

Reputation: 922

Check this link:

How to hide the close button and close action in alert view to display only "Open app" buttom. According the answers, it's not possible to hide the cancel button. But it's worth it check it out.

Hope it helps

Upvotes: 0

Eagle11
Eagle11

Reputation: 661

You can always modify your alert view by subclassing it. Not the easiest thing in the world, but I don't know of another way to accomplish what you are trying to do.

This link shows how to make the alert view look however you want it to. http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-uialertview-custom-graphics/

Upvotes: 1

Malloc
Malloc

Reputation: 16276

You should set the button index of cancel button to -1:

alert.cancelButtonIndex = -1;

As the Doc say about the cancelButtonIndex:

The button indices start at 0. If -1, then the index is not set.

Upvotes: 0

Related Questions