你好,歡迎來到IOS教程網

 Ios教程網 >> IOS訊息 >> 關於IOS >> iOS中如何用UIAlertView來確認提交動作?

iOS中如何用UIAlertView來確認提交動作?

編輯:關於IOS

原問題描述:

大家好,請教一個關於UIGestureRecognizer的問題。 比如我需要在用戶在操作之後,用UIAlertView來確認提交動作,我試過一些方法都沒成功。   解決方案: 這樣: [java]   UISwipeGestureRecognizer *gesture1 = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipeRight:)];   gesture1.direction = UISwipeGestureRecognizerDirectionRight;   [yourView addGestureRecognizer:gesture1];       在Action方法中: [java]   -(void)didSwipeLeft:(UIGestureRecognizer *)gestureRecognizer {       UIAlertView *Alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Are you sure to commit with its action" delegate:self cancelButtonTitle:CKString(@"NO") otherButtonTitles:CKString(@"YES"),nil];       [Alert show];       Alert.tag=222;       Alert.delegate=self;       [Alert release];   }       在AlertView Delegate [java]   -(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {          if(alertView.tag==222) {           if(buttonIndex==1)           {               //// Yes condition           } else {              ///// No condition           }       }   }      
  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved