어떻게하면 UIAlertView를 닫을 수 있습니까? 이 코드는 작동하지 않습니다.어떻게 UIAlertView를 닫을 수 있습니까?
@property (nonatomic, retain) UIAlertView *activityAlertView;
- (void)viewDidLoad
{
self.activityAlertView = [[UIAlertView alloc] initWithTitle:@"Receiving data" message:@"\n\n"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil, nil];
[activityAlertView show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
}
-(void) myfunc
{
[self alertView:activityAlertView clickedButtonAtIndex:1];
}
Thnx Buddy ... :-) – Ayaz
취소 버튼 색인을 사용하는 것이 더 깔끔합니다 :'[myAlertView dismissWithClickedButtonIndex : myAlertView.cancelButtonIndex animated : YES];'. –
@VincentTourraine 오, 당신이 거기에서 파고 드린 오래된 대답. 취소 버튼 색인이 올바른 경우 원하는 동작에 따라 다릅니다. 경고를 무시하고 싶다면 '-1'을 선택하십시오. 취소 사례를 통해 실행하는 것이 좋으면 취소 버튼 색인이 올바른 것입니다. – JustSid