标签: uidatepicker

iPad上的UIActionSheet中的UIDatePicker

在我的应用程序的iPhone版本中,我有UIDatePicker一个UIActionSheet.看来是对的.我现在正在设置应用程序的iPad版本,UIActionSheet在iPad上查看时显示为空白空白框.

这是我正在使用的代码:

UIDatePicker *datePickerView = [[UIDatePicker alloc] init];
    datePickerView.datePickerMode = UIDatePickerModeDate;

    self.dateActionSheet = [[UIActionSheet alloc] initWithTitle:@"Choose a Follow-up Date"
                                                   delegate:self cancelButtonTitle:nil 
                                     destructiveButtonTitle:nil otherButtonTitles:@"Done", nil];

    [self.dateActionSheet showInView:self.view];
    [self.dateActionSheet addSubview:datePickerView];
    [self.dateActionSheet sendSubviewToBack:datePickerView];
    [self.dateActionSheet setBounds:CGRectMake(0,0,320, 500)];

    CGRect pickerRect = datePickerView.bounds;
    pickerRect.origin.y = -95;
    datePickerView.bounds = pickerRect;
Run Code Online (Sandbox Code Playgroud)

iphone uidatepicker uiactionsheet ipad

15
推荐指数
1
解决办法
1万
查看次数

如何制作仅覆盖屏幕一半的模态日期选择器?

我希望与iPhone联系人应用程序中的生日日期设置器具有相同的效果.如何才能在屏幕中间显示模态日期选择器.

我希望日期选择器超过UITableView(就像在iphone联系人应用程序中).我希望UITableView能够在日期选择器后面自由滚动(就像在iphone联系人应用程序中一样).

提前致谢.

iphone uidatepicker uiviewcontroller modalviewcontroller

15
推荐指数
1
解决办法
2万
查看次数

使用UIToolbar的UIDatePicker

我正试图在UIDatepicker上实现UIToolbar,以便在触摸"完成"按钮时将其关闭.但是当我点击按钮时,日期选择器正在滚动,操作按钮不起作用.

这是我的代码:

datepicker = [[UIDatePicker alloc] initWithFrame:CGRectZero];
[datepicker setDatePickerMode:UIDatePickerModeDate];
[datepicker addTarget:self action:@selector(changeDate:) forControlEvents:UIControlEventValueChanged];

UIToolbar *toolbar= [[UIToolbar alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,44)];
toolbar.barStyle = UIBarStyleDefault;
UIBarButtonItem *flexibleSpaceLeft = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem* doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(dismiss)];

[toolbar setItems:[NSArray arrayWithObjects:flexibleSpaceLeft, doneButton, nil]];
[datepicker addSubview:toolbar];
Run Code Online (Sandbox Code Playgroud)

我的日期选择器:

的UIDatePicker

谢谢您的帮助.

objective-c uidatepicker uitoolbar ios

15
推荐指数
1
解决办法
6956
查看次数

如何在Swift中为日期选择器设置特定的默认时间

有没有办法设置日期选择器来显示加载时的特定时间?我从开始时间,结束时间,四个文本区发起了四个日期选择器的情况下,开始日期和使用从GitHub上的squimer/datePickerDialog子类,在一个UIAlertView中弹出的完成日期.

在我的应用程序中,默认开始时间是早上7:00,默认结束时间是下午5:00,让用户调整这些时间.

我只能看到你可以将datePicker.defaultDate设置为currentDate,minimumDate或maximumDate并且只能设置一次.是否可以在我的来自ViewController的调用中将defaultDate设置为sTime ="07:00"和fTime ="17:00"的硬编码字符串?

任何帮助,将不胜感激.

编辑:这是我从viewController调用子类的方式

@IBAction func setFT(sender: UITextField) {
    resignKeyboardCompletely(sender)
    DatePickerDialog().show("Pick a Finish Time", doneButtonTitle: "Done", cancelButtonTitle: "Cancel", datePickerMode: .Time) {
        (timeFinish) -> Void in
        self.dateFormatter.dateFormat = "HH:mm"
        let finTime = self.dateFormatter.stringFromDate(timeFinish)
        self.finishTime.text = finTime
    }
    defaults.setObject(finishTime.text, forKey: "finishTime")
    print(finishTime.text)
}
Run Code Online (Sandbox Code Playgroud)

请注意,在此期间,我还尝试通过NSUser Defaults维护持久性.

uidatepicker swift

15
推荐指数
1
解决办法
3万
查看次数

用UIPickerView优雅地替换iPhone键盘

我有一个表视图,其中嵌入了UITextFields来输入一些数据.它还有另外两个弹出UIPickerView和UIDatePicker的字段 - 如Apple的DateCell示例所示.

大多数情况下它可以工作,但我无法弄清楚如何从文本字段键盘干净地过渡到其他选择器 - 一个滑出,一个滑入 - 它看起来很奇怪,桌面视图上的滚动位置有时会搞砸 - 一切滚动顶部.

我想要做的是替换文本字段键盘,而不用它动画离开,没有它将表视图恢复到完整大小.

有线索吗?

iphone uidatepicker uipickerview uitextfield

14
推荐指数
2
解决办法
3万
查看次数

为什么jQuery UI datepicker不能在jQuery对话框模式中工作?

我想在我的一个文本输入中使用jQuery UI datepicker.这个是一个对话模式.

事实上,我可以在正常的文档文本输入中调用datepicker,并且我正常地得到了我的日历,但我不能在对话模式文本输入中做到这一点(在模态文本输入内部克隆之后我没有任何JavaScript错误).

这是我调用datepicker的代码:

$(function() {
    $("#MytextInputID").datepicker({ dateFormat: 'dd/mm/yy' });
);
Run Code Online (Sandbox Code Playgroud)

我试过更改css .ui-datepicker Z-index属性,但我什么都没有.

你有解决这个问题的技巧吗?

问候,


在my_page.html我有

function openSaisieARModal()
        {
            window_select_CodeAgence = new showModalWindow('SaisieARModal', 500);
        }

我使用这个脚本

var showModalWindow=function(id, width)
{
    var newId=id+'Copy';
    this.id=newId;

var previousNode=document.getElementById(newId);
if(previousNode!=null)
{
    previousNode.parentNode.removeChild(previousNode);
}

var rootNode=document.getElementsByTagName('body')[0];
this.node=document.createElement("div");
rootNode.appendChild(this.node);
this.node.setAttribute('id', newId);
this.node.setAttribute('title', document.getElementById(id).getAttribute('title'));
this.node.innerHTML=document.getElementById(id).innerHTML;
if(width==null)
{
    width=400;
}
$('#'+newId).dialog({autoOpen: true, modal: true, width:width });

this.closeWindow=function()
{
    $('#'+this.id).dialog('close');
}

this.centerContent=function()
{
    this.node.style.textAlign='center';
}

this.center=function()
{
    $('#'+this.id).dialog('option', 'position', 'center');
}
Run Code Online (Sandbox Code Playgroud)

}

这是my_page.html中的模态HTML代码

<div style="display:none;">
        <div id="SaisieARModal" …
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)

jquery datepicker uidatepicker jquery-ui-datepicker

14
推荐指数
3
解决办法
4万
查看次数

如何结合两个UIDatePickers的日期和时间?

UIDatePickers我的应用程序中有两个,一个模式用于选择日期,另一个模式用于选择时间模式.当达到确切的日期和时间时,我已经发出通知.我能够在正确的时间触发提醒,但问题是没有检查日期.有没有办法同时检查日期和时间?

提前完成了...

编辑

NSDate *date1 = [datePicker date];
NSDate *date2 = [timePicker date];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];

unsigned unitFlagsDate = NSYearCalendarUnit | NSMonthCalendarUnit |  NSDayCalendarUnit;
NSDateComponents *dateComponents = [gregorian components:unitFlagsDate fromDate:date1];
unsigned unitFlagsTime = NSHourCalendarUnit | NSMinuteCalendarUnit ;
NSDateComponents *timeComponents = [gregorian components:unitFlagsTime fromDate:date2];

[dateComponents setHour:[timeComponents hour]];
[dateComponents setMinute:[timeComponents minute]];

NSDate *combDate = [gregorian dateFromComponents:dateComponents];   

UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil) return;
NSDate *fireTime = combDate;
localNotif.fireDate = fireTime;
localNotif.alertBody = @"Alert!";
localNotif.soundName …
Run Code Online (Sandbox Code Playgroud)

iphone uidatepicker ios

14
推荐指数
2
解决办法
2973
查看次数

在iPad for iOS 8.1上,UIDatePicker不显示月中某天(dd)的滚轮

我在带静态单元格的TableView中有一个UIDatePicker.DatePicker在iPhone版本的App中运行良好,但iPad似乎压缩了DatePicker,因此不会显示保存月份日期(dd)的中心列.请注意,"十一月"中的"er"被截断.

我通过将日期样式更改为西班牙语(dd MMMM YYY)来验证这一点,日期显示为月份的上半月和全年.每个月的名字的后半部分被截断.

移植到iOS 8有没有遇到过这样的问题?

永远不确定要发布多少代码.以下是相关课程中的大部分内容

@property (strong, nonatomic) IBOutlet UITableViewCell *dateDisplay;
@property (strong, nonatomic) IBOutlet UITableViewCell *datePickerCell;
@property (strong, nonatomic) IBOutlet UIDatePicker *datePicker;

@property (strong, nonatomic) IBOutlet UITableViewCell *unattached;
@property (strong, nonatomic) IBOutlet UITableViewCell *middleschool;
@property (strong, nonatomic) IBOutlet UITableViewCell *highschool;
@property (strong, nonatomic) IBOutlet UITableViewCell *collegiate;
@property (strong, nonatomic) IBOutlet UITableViewCell *youthclub;

@end

@implementation MeetFinderTableViewController

@synthesize divisions = _divisions;
@synthesize datePickerIndexPath = _datePickerIndexPath;
@synthesize meetDate = _meetDate;

@synthesize doSaveUserDefaults = _doSaveUserDefaults;
@synthesize divisionSelected = _divisionSelected;
@synthesize arrayOfReuseIds …
Run Code Online (Sandbox Code Playgroud)

date datepicker uidatepicker ipad ios

12
推荐指数
1
解决办法
3595
查看次数

如何将UIDatePicker更改为特定时间(在代码中)

我需要动态地将UIDatePicker更改为特定的.

我的日期选择器仅设置为时间模式.我可以设定时间

timePicker.setDate(NSDate(), animated: false)
Run Code Online (Sandbox Code Playgroud)

但我无法弄清楚如何将其更改为不同的时间而不是当前时间.

那么我该怎么改呢?

谢谢

uidatepicker ios swift

12
推荐指数
4
解决办法
2万
查看次数

滚动完成后,UIDatePicker会产生反馈.需要说明

所以我以编程方式初始化了UIDatePicker.它有一些子视图NSLayoutConstraints.它还有自定义文本颜色setValue(textColor, forKey:"textColor").它的位置在superview的帮助下NSLayoutConstraints.

每次停止滚动时,都会在调试区域中生成一些文本:

<_UIFeedbackRetargetBehavior:0x60000011b750:prepared = 0>正在被激活多次激活,这将很快提升!

所以我有点担心.Google一无所获......有人有解释吗?

Xcode 8. Swift 3. iPhone SE模拟器.

xcode uidatepicker ios swift xcode8

12
推荐指数
1
解决办法
1406
查看次数