在我的应用中,我需要在UIAlert视图上有一个日期选择器
实施的但是当我在警报视图中使用此日期选择器时,是警报视图中的一些高度问题我试图为警报视图设置框架,但它没有设置要做什么?
我的代码:
-(void)SetDate
{
dobPicker = [[UIDatePicker alloc] init];
dobPicker.frame=CGRectMake(20, 25.0, 240.0, 150.0);
dobPicker.datePickerMode = UIDatePickerModeDateAndTime;
[dobPicker setDate:[NSDate date]];
UIAlertView *dAlert = [[UIAlertView alloc] initWithTitle:@"Set Date" message:@"nnnnnnn" delegate:self cancelButtonTitle:@"Set Current Date" otherButtonTitles:@"Set New Date", nil];
dAlert.frame=CGRectMake(10, 10.0, 300.0, 400.0);
dAlert.delegate = self;
[dAlert addSubview:dobPicker];
[dAlert show];
[dAlert release];
}
- (void) alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
NSDate *date = [dobPicker date];
NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:(NSString*) @"yyyy-MM-dd"];
NSLog(@"-------------------------- %@", [dateFormatter stringFromDate:date]);
}
答案 0 :(得分:1)
Transform
Scale
您的UIAlertView
就像这样:
dAlert.transform = CGAffineTransformScale(dAlert.transform,xScaleHere, yScaleHere); //provide your scaling points sx and sy according to your requirement.
答案 1 :(得分:1)
简单:... [UIAlertView ..
消息:@ “\ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n” 个
...
也..查看UIAlertView的标题..尝试修改“y”从25到40 ..(测试)
dobPicker.frame = CGRectMake(20,40.0,...