- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个委托(delegate),它接收一条消息,以删除该项目作为参数的项目。
我想显示一个确认 AlertView,然后,如果用户按是,我想删除它。
所以,我所拥有的是
被调用的委托(delegate)方法:
- (void) deleteRecording:aRecording(Recording*)aRecording {
NSLog(@"Cancel recording extended view");
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: NSLocalizedString(@"Cancel recording",nil)
message: NSLocalizedString(@"Are you sure you want to cancel the recording?",nil)
delegate: self
cancelButtonTitle: NSLocalizedString(@"No",nil)
otherButtonTitles: NSLocalizedString(@"Yes",nil), nil];
[alert show];
[alert release];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
switch (buttonIndex) {
case 0:
{
NSLog(@"Delete was cancelled by the user");
}
break;
case 1:
{
NSLog(@"Delete deleted by user");
}
}
}
最佳答案
myAlertView.tag = YOUR_INT;
According to the documentation,
Note : The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.
So please use the 3rd method only if you are not intending to submit app to app store. Thanks user soemarko ridwan for the tip.
@interface CustomAlertView : UIAlertView
@property (nonatomic, retain) id object;
@end
@implementation CustomAlertView
@synthesize object;
- (void)dealloc {
[object release];
[super dealloc];
}
@end
CustomAlertView *alert = [[CustomAlertView alloc]
initWithTitle: NSLocalizedString(@"Cancel recording",nil)
message: NSLocalizedString(@"Are you sure you want to cancel the recording?",nil)
delegate: self
cancelButtonTitle: NSLocalizedString(@"No",nil)
otherButtonTitles: NSLocalizedString(@"Yes",nil), nil];
[alert setObject:YOUR_OBJECT];
[alert show];
[alert release];
- (void)alertView:(TDAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
NSLog(@"%@", [alertView object]);
}
关于ios - 向 AlertView 发送参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13047527/
在我的应用程序中,我需要在用户单击警报 View 中的按钮时关闭警报 View 。我在我的应用中尝试了 [alertView dismissWithClickedButtonIndex:-1 anim
我在显示 5 个选项卡的 MainWindow.xib 上添加了一个选项卡栏 Controller ,并在我的应用程序委托(delegate)中具有选项卡栏 Controller 的委托(delega
我想显示嵌套的alertView。我在嵌套alertViews中面临的问题是,当我单击第一个alertView的“添加”按钮时,它显示第二个alertView,在第二个alertView中我有一个文本
如果我在 Controller 上有多个 AlertView,如果所有 AlertView 都分别触发,如何让它只显示最后一个 AlertView?请看下面的代码: override func vie
正如上面的问题所述,我对 iOS 非常陌生;我正在尝试执行这 3 个简单的步骤。 显示提醒 View 进行解析工作 关闭提醒 我正在寻找类似 android 中的东西,即 Pre Execute、do
我最近开始研究 iOS 开发,如果我问的问题太明显,请原谅我。 当我的应用程序的 View 加载时,它会检查某些键的配置,如果这些键没有值,应用程序应显示警报并退出。 首先,我已经实现了 UIAler
我正在定制 keyboard (iOS App Extension) .我有一个 UICollectionView在我的Keyboard Layout , 所以当一个 item已选中 我要显示 mes
我对警报 View 有一个小问题,想法是当应用程序启动时,它会在后台询问应用程序的新数据,因此在收到信息后,如果有新数据,则应显示警报 View 。问题来了,因为 AlertView 只显示在我启动
我首先使用“[UIAlertView alloc] initWithTitle:”来调整大小和自定义带有图像的AlertView,但失败了。 然后我使用以下代码,一切正常(调整了 alertView
我希望用户无法单击 UIAlertView 上的取消按钮,但我仍然希望它在那里,但被遮蔽了。我知道那里有一个 shouldEnableFirstButton 函数,但它不涉及取消按钮。你知道怎么做吗?
这似乎是 iPhone 的白象。我已经尝试了各种方法,甚至是循环,但我无法让它工作。 我有一个加载表格的 View 。然而,我已经进入对象归档,出于开发目的,我想要一个初始的 AlertView,询问
我想在没有按钮的 AlertView 中显示一个事件指示器,我想在事件指示器停止动画时禁用它。 最佳答案 UIAlertView *alert = [[UIAlertView alloc] initW
我刚刚看到无论如何都可以在主屏幕的背景中显示 AlertView。 这是由应用“UP by Jawbone”触发的 有人知道怎么做吗? 最佳答案 这是一条系统消息,因为 UP 尝试使用蓝牙。它不是由应
如何在不使用任何取消按钮的情况下让 alertview 自行消失? 最佳答案 使用这个... -(void)showAlertView { // code for showing your al
我正在尝试创建一个提醒 View ,在点击广告按钮后将一个或多个项目添加到我的表格 View 中。在按下添加按钮时,alertview 应该出现三个文本字段,用于显示项目名称、价格和数量,当按下确定按
我有一个警报 View ,其中添加了一个 uitextfield 作为 subview 。 在我的 uitableview Controller 中,键盘显示正常。 然而,在不同的角度来看,我想做同样
我有一个 UIAlertView,里面有一个 UITextField。我想输入 mail id 并在 UIAlertView 的 ok 按钮中提交,但是 UITextField 在 UIAlert
我有一个委托(delegate),它接收一条消息,以删除该项目作为参数的项目。 我想显示一个确认 AlertView,然后,如果用户按是,我想删除它。 所以,我所拥有的是 被调用的委托(delegat
希望你能帮助我。我如何用 else 语句显示alertView。在我的示例中,我检查文本字段是否为空。当它们为空时,它们将填充用户文本输入。现在,如果所有文本字段都填充了文本,我将显示一个警报 Vie
所以我让警报 View 检测是否存在事件的互联网连接。 这是代码: - (void)viewDidLoad { [super viewDidLoad]; [[NSNotificatio
我是一名优秀的程序员,十分优秀!