我是新的应用。 我想设计一个警示,有2个县:OK
和
Cancel
。 当用户触动OK
,则我将打印以下信息:hello/code>。 当它们触及<代码>Cancel
纽扣时, 页: 1
请帮助;我如何这样做?
我是新的应用。 我想设计一个警示,有2个县:OK
和
Cancel
。 当用户触动OK
,则我将打印以下信息:hello/code>。 当它们触及<代码>Cancel
纽扣时, 页: 1
请帮助;我如何这样做?
显示警示:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Do you want to say hello?"
message:@"More info..."
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Say Hello",nil];
[alert show];
[alert release];
a. 应对任何纽特:
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
NSLog(@"Cancel Tapped.");
}
else if (buttonIndex == 1) {
NSLog(@"OK Tapped. Hello World!");
}
}
For more information, see AlertView Reference和。
由于所选择的答案被解释,这里是新的解决办法:
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"My Alert"
message:@"This is an alert."
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[alert addAction:defaultAction];
[self presentViewController:alert animated:YES completion:nil];
如。
显示警示和下列警示:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Make an informed choice" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; [alert show];
当警报被解除时,该代表将自行决定。 该代表必须执行《律师证明书》。
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger) buttonIndex{ if (buttonIndex == 1) { // Do it! } else { // Cancel } }
<>目标C:
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"My Alert"
message:@"This is an action sheet."
preferredStyle:UIAlertControllerStyleAlert]; // 1
UIAlertAction *firstAction = [UIAlertAction actionWithTitle:@"one"
style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
NSLog(@"You pressed button one");
}]; // 2
UIAlertAction *secondAction = [UIAlertAction actionWithTitle:@"two"
style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
NSLog(@"You pressed button two");
}]; // 3
[alert addAction:firstAction]; // 4
[alert addAction:secondAction]; // 5
[self presentViewController:alert animated:YES completion:nil]; // 6
<>Swift>
let alert = UIAlertController(title: "My Alert", message: "This is an action sheet.", preferredStyle: .Alert) // 1
let firstAction = UIAlertAction(title: "one", style: .Default) { (alert: UIAlertAction!) -> Void in
NSLog("You pressed button one")
} // 2
let secondAction = UIAlertAction(title: "two", style: .Default) { (alert: UIAlertAction!) -> Void in
NSLog("You pressed button two")
} // 3
alert.addAction(firstAction) // 4
alert.addAction(secondAction) // 5
presentViewController(alert, animated: true, completion:nil) // 6
www.un.org/Depts/DGACM/index_spanish.htm 下面是几个展示方式。 关于Pi的警报信息
(包括来源代码的XCode项目)
/ 与大韩民国一道发出警报,取消纽芬兰
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView"
message:@"My message" delegate:self cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
[alert show];
[alert release];
对于你可以使用的精减产出(有时,由于在器件上投射时,而不是在X条码上投射时出现ug缩,你可能会使用安全记录仪):
#define MY_ALERT(str) [[[UIAlertView alloc] initWithTitle:@"System Alert" message:str delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show]
之后,在你的法典中,你可以做到:
MY_ALERT(NSStringFromCGRect(someView.frame))
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"Hello world" message:@"This is an alert view" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
In this way we create an object of class UIAlertView
and set the title "Hello world" and the message "This is an alert view " and the title of button as ok.
For a detail answer visit this blog
I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...
HI, In our application i am using corelocationframework when opening application a alert for allow and dont allow.when clicking on the allow for current location we will show current location.When ...
Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...
我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......
我希望我与四舍五入的累进角进行网上讨论。
我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
I like to write bash shell scripts on my iPhone, put them in an app folder with an icon, plist, etc., so they execute like apps by tapping their icon on SpringBoard. This is not interactive like ...