首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >UIAlertView问题

UIAlertView问题
EN

Stack Overflow用户
提问于 2009-12-30 20:12:57
回答 2查看 446关注 0票数 0

我正在尝试对警报上按下的任何按钮采取行动。我有以下代码和第一个警报弹出,但它永远不会到达第二个。

我已经对其进行了设置,以便在标题中也定义UIAlertViewProtocol。

代码语言:javascript
复制
-(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
    if(buttonIndex != [actionSheet cancelButtonIndex])
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Something actually happened" message:@"Something was done" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"test",nil];
        [alert show];

    }

}

    -(void)alert:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if(buttonIndex ==0)
    {
        NSLog(@"tetetete");
        UIAlertView *a = [[UIAlertView alloc] initWithTitle:@"test" message:@"test" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [a show];
        [a release];
        [alert release];    
    }

}
EN

Stack Overflow用户

发布于 2012-07-27 21:15:45

我已经修改了你的代码,检查一下

代码语言:javascript
复制
-(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
    if(buttonIndex != [actionSheet cancelButtonIndex])
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Something actually happened" message:@"Something was done" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"test",nil];
        [alert show];
        [alert release];

    }

}

    -(void)alert:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if(buttonIndex ==0)
    {
        NSLog(@"tetetete");
        UIAlertView *a = [[UIAlertView alloc] initWithTitle:@"test" message:@"test" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [a show];
        [a release];
        [a release];    
    }

}
票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1979881

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档