iphone - UIAlertView按钮操作代码

标签 iphone xcode4 action uialertview

有人知道如何为 UIAlertview 中的按钮执行操作吗?如果是这样,请指导我。

最佳答案

- (void)alertView:(UIAlertView *)alertView 
         didDismissWithButtonIndex:(NSInteger) buttonIndex 
{
    if (buttonIndex == 0)
    {
        NSLog(@"Cancel Tapped.");
    }
    else if (buttonIndex == 1) 
    {    
        NSLog(@"OK Tapped. Hello World!");
    }
}

试试这个代码,它会为你工作......

关于iphone - UIAlertView按钮操作代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5987926/

相关文章:

android - Android SDK 中可用的所有 "android.intent.action"操作的详尽列表是什么?

asp.net-mvc - ActionFilterAttribute mvc 需要调用一次

javascript - 无法访问 Action 类中禁用下拉列表的所选项目的值(struts 2)

iphone - 将基于自定义 View 的 UIBarButtonItem 放置在没有默认水平填充的导航栏中

iphone - 如何在 iPhone NSString 中查找字母、特殊字符?

interface-builder - 如何修复 Interface-Builder fubar 的项目

iphone - Xcode 项目的 "Build number"

iphone - 将配件连接到我的越狱 iPhone 设备

ios - Unity Facebook 插件在登录后终止应用程序(iOS)

xcode - 为什么 Xcode 4 不创建任何产品?