相关疑难解决方法(0)

使UIAlertView阻止

我需要UIAlertView阻止.因为我有功能,我需要返回UIAlertView选择.但问题是显示后UIAlertView我的功能代码进一步执行所以我无法UIAlertView选择(我可以在委托方法中执行,但我需要返回函数结果).

我试图UIAlertVIew阻止NSCondition.但代码不起作用.

condition = [NSCondition new];
result = 0 ; 
[condition lock];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Fingerprint" message:@"test" delegate:window_self cancelButtonTitle:@"No" otherButtonTitles:@"Yes",nil];
[alert setDelegate:self];
[alert show];
while (result == 0) [condition wait];
[condition unlock] ;

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
 [condition lock] ;
 if (buttonIndex == 0)
 {
  result = 2; 
 }
 else if (buttonIndex == 1)
 {
  result = 3 ;
 }
 [condition signal] ;
 [condition unlock] …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch ios

8
推荐指数
2
解决办法
7400
查看次数

标签 统计

cocoa-touch ×1

ios ×1