【发布时间】:2013-07-25 23:18:33
【问题描述】:
刚开始学习Obj-C;如果有任何幼稚的问题,请原谅。
我正在尝试创建一个应用程序,该应用程序根据在日期选择器中选择的日期显示自定义警报视图。
这是我现在已经有权的代码,它在选择任何日期时显示一个硬编码的警报浏览量,并删除按钮。我怎样才能使依赖于所选日期。
(#)import "APViewController.h"
@interface APViewController ()
@end
@implementation APViewController
@synthesize datePicker;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)specialButton:(id)sender {
// NSDate *chosen = [datePicker date];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Woohoo !" message:@"Its your 50th Birthday" delegate:nil cancelButtonTitle:@"Thanks" otherButtonTitles:nil];
[alert show];
}
@end
【问题讨论】:
-
“取决于所选日期”是什么意思?您希望该日期出现在警报中吗?
-
@rdelmar 根据在选择器中选择的日期,alertview 必须发出警报。如果选择了 7 月 2 日,则应该说 8 月 10 日(无论何时)生日快乐妈妈和爸爸生日快乐。警报在按下按钮时执行。
标签: ios objective-c datepicker