[英]how to change the view from UIalertview?
請向我解釋當我單擊顯示為特定形式的UIalertView時如何更改UIView
類。 如果您知道任何教程,請不要猶豫
假設收到特殊數據包時我當前正在顯示viewcontoller1,那么我必須根據用戶選擇顯示另一個XIB
我曾在UIAlertView委托中嘗試過pushViewController,但無法使用
使用UIAlertView委托。 因此,在您要致電的特定班級中。 在頭文件中,這樣添加
@interface SomeClass : UIViewController <UIAlertViewDelegate> {
...
然后,當警報為alloc / init時,設置委托
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"title" message:@"message" delegate:self cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil];
[alert setDelegate:self];
[alert show];
在與alertView相同的類中,放入此委托方法。
-(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
if ([alertView cancelButtonIndex] == buttonIndex){
return;
//Do your UIView change here
}
希望這可以幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.