2013-07-25 31 views
0

默認情況下,帶有兩個按鈕的UIAlertView對每個按鈕都有不同的字母。如何爲UIAlertView設置相同的按鈕值?

有沒有辦法使它們看起來與不同文本看起來完全相同,而不需要子類UIAlertView,或者製作自定義警報視圖?

下面是我用什麼:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle: 
        kAlertTitleOrderType message:kAlertMessageOrderType delegate:delegate 
        cancelButtonTitle:nil otherButtonTitles:@"Collection", @"Delivery", nil]; 

enter image description here

+1

我毀了我的答案,因爲它證明是錯誤的。有關更多信息,請參閱http://stackoverflow.com/questions/7250360/uialertview-without-cancel-button。看起來你可能不得不推出自己的!有趣的是,這種行爲在iOS 7中是「固定的」(即取消按鈕是可選的,如果你沒有它們,所有的按鈕呈現相同),所以它可能是一個錯誤。 –

+0

謝謝。的確,我似乎必須使用自定義的alertView。 – bursyllac

回答

0

如果在調用initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:則沒有取消按鈕將被添加時設置的cancel按鈕nil(這是一個看起來不同)。您可以根據需要添加其他按鈕。

+0

不起作用。這裏是我的行: UIAlertView * alert = [[UIAlertView alloc] initWithTitle:kAlertTitleOrderType message:kAlertMessageOrderType delegate:delegate cancelButtonTitle:nil otherButtonTitles:@「Collection」,@「Delivery」,nil]; – bursyllac

+0

你能提供你在屏幕上看到的結果的屏幕截圖嗎? – Wain

+0

我剛上傳截圖。 – bursyllac

相關問題