我想显示一条警告消息,我正在使用带有XCode 6.1的iOS SDK 8.1.我知道UIAlertView已被弃用; 但是,我的应用程序还必须支持iOS 7,如果应用程序在iOS 7设备上运行,我必须使用UIAlertView.此警报视图有一个文本字段和两个按钮,其中一个是默认取消按钮.只要文本字段为空,就应禁用其他按钮.
这是我的代码:
class MyViewController : UIViewController, UIAlertViewDelegate {
var addRecipientAlertView:UIAlertView?
// Irrelevant code here
func performSomething(someValue:String) {
addRecipientAlertView = UIAlertView(title: "Title", message: "Enter full name of user, email of user or a free-form text", delegate: self, cancelButtonTitle: "Cancel", otherButtonTitles: "Add Recipient")
addRecipientAlertView!.alertViewStyle = UIAlertViewStyle.PlainTextInput
addRecipientAlertView!.accessibilityValue = someValue
// Text Field Settings
let textField:UITextField = addRecipientAlertView!.textFieldAtIndex(0)!
textField.placeholder = "Full Name, Email or Any Text"
textField.keyboardType = UIKeyboardType.EmailAddress
textField.clearButtonMode = UITextFieldViewMode.Always
addRecipientAlertView!.show()
}
}
func alertViewShouldEnableFirstOtherButton(alertView: …Run Code Online (Sandbox Code Playgroud) 我的应用程序正在等待Apple的评论发布,并且我的应用程序中没有支持Apple Watch的设置.我的问题是:安装我的应用程序的设备的通知是否会自动显示在Apple Watch上,而不对我的应用程序进行任何更新/更改(例如添加Apple Watch作为目标)?如果是这样,我的iOS应用程序的推送通知操作是否也可以在Apple Watch上使用(当然功能正常)?