Ios UIAlertView即使在采取响应操作后也不会褪色
在我的UIAlertView中,我想在按下“确定”按钮时打开另一个UIView 但问题是,即使在显示UIView之后,警报仍会保留在屏幕上,一旦警报消失,UIView似乎会被禁用Ios UIAlertView即使在采取响应操作后也不会褪色,ios,objective-c,uialertview,uialertviewdelegate,Ios,Objective C,Uialertview,Uialertviewdelegate,在我的UIAlertView中,我想在按下“确定”按钮时打开另一个UIView 但问题是,即使在显示UIView之后,警报仍会保留在屏幕上,一旦警报消失,UIView似乎会被禁用 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Add details" message:@" Do you like to set the details now?" delegate:self cancelButtonTitle:@"Yes" ot
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Add details" message:@" Do you like to set the details now?" delegate:self cancelButtonTitle:@"Yes" otherButtonTitles:@"No",nil];
[alert show];
[alert release];
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{ // the user clicked one of the OK/Cancel buttons
NSString *title = [alertView title];
if([title isEqualToString:@"Add details"])
{
.......
任何帮助都将不胜感激 为什么不检查委托方法中按下的按钮而不是标题? 就是在
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0){
// User pressed "YES"
}else{
// User pressed "NO"
}
}
“取消”按钮的索引为0,其他按钮的索引增加。为了检测这是哪个警报,您还应该给它一个标签。希望这有帮助。可能是因为新视图是在警报视图实际取消之前添加的。因此,最好使用didDismissWithButtonIndex委托在现有警报视图的按钮单击事件上显示新视图,而不是ClickedButtonIndex 而不是
- (void) alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
//Add the view
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
//Add the view
}