iOS8 UIAlertController弹出框中添加视图(例如日期选择器等等)

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

UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"\n\n\n\n\n\n\n\n\n\n\n\n" message:nil   preferredStyle:UIAlertControllerStyleActionSheet];

[alert.view addSubview:datePicker];

UIAlertAction *ok = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {

NSDateFormatter* dateFormat = [[NSDateFormatter alloc] init];

//实例化一个NSDateFormatter对象

[dateFormat setDateFormat:@"yyyy-MM-dd"];//设定时间格式

NSString *dateString = [dateFormat stringFromDate:datePicker.date];

//求出当天的时间字符串

NSLog(@"%@",dateString);

}];

UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {

  }];

[alert addAction:ok];

[alert addAction:cancel];

[self presentViewController:alert animated:YES completion:^{ }];

时间: 2024-08-03 22:00:43

iOS8 UIAlertController弹出框中添加视图(例如日期选择器等等)的相关文章

IOS UIAlertController 弹出框中添加视图(例如日期选择器等等)

UIDatePicker *datePicker = [[UIDatePicker alloc] init]; datePicker.datePickerMode = UIDatePickerModeDate; UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"\n\n\n\n\n\n\n\n\n\n\n\n" message:nil  preferredStyle:UIAlertContr

在弹出框中无法使用select2的问题

通常情况下,使用select2只需要在加载相关js和css后,添加如下代码即可: $("#selectId").select2(); 但如果这个select在弹出框中,这样使用往往是无效的,这时候需要这样写: $.fn.modal.Constructor.prototype.enforceFocus = function () {$("#selectId").select2(); }; 参考https://github.com/select2/select2/iss

使用easeui dialog弹出框中使用CKeditor多次加载后无法编辑问题

问题呈现:弹出框页面 <tr class="addtr"> <th>内容</th> <td> <!-- <textarea rows="15" cols="50" id="content" name="content" class="ckeditor">请输入.</textarea> --> <te

clipboard.js在弹出框中无法复制的问题

前几天发现了个bug,在jquery-ui的弹出框(dialog)中,使用clipboard.js实现的复制功能,竟然不会生效,后面查了下相关资料,发现不止jquery-ui的dialog不行,其他的模态框,例如bootstrap的,也是一样不会生效的.原因就是弹出框会自动focus,而复制的底层实现是要获取选中的内容,失去焦点后就无法获取到了,从而导致复制失败. 解决办法: 1)对于 Bootstrap 模态框(Modals)中使用,或是在其他修改焦点的类库中使用,你会希望将获得焦点的元素设置

mvc 在弹出框中实现文件下载

var myParent = parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.parent; FileDown = function (fileName, realFileName) { $(myParent.document.body).find("#down-file-iframe").remove(); var $iframe = $('<iframe name=&qu

android中怎么把自己需要的app启动图标集中到一个弹出框中

先看效果图 这个是我们自己的apk点击之后的效果 下边是布局文件 activity_main.xml主布局文件 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:la

layer弹出框中icon数字参数说明

icon参数为0,如下代码: layer.msg('请选择要编辑的机构', {icon: 0}); 运行结果如图: icon参数为1,如下代码: layer.msg('请选择要编辑的机构', {icon: 1}); icon参数为2,如下代码: layer.msg('请选择要编辑的机构', {icon: 2}); 运行结果如图: icon参数为3,如下代码: layer.msg('请选择要编辑的机构', {icon: 3}); 运行结果如图: icon参数为4,如下代码: layer.msg('

[js]uploadify结合jqueryUI弹出框上传,js中的冒出的bug,又被ie坑了

引言 最近在一个项目中,在用户列表中需要对给没有签名样本的个别用户上传签名的样本,就想到博客园中上传图片使用弹出框方式,博客园具体怎么实现的不知道,只是如果自己来弄,想到两个插件的结合使用,在弹出框中使用uploadify插件进行上传,每次都会报错很是无语,最后找到解决方案,这里记录一下,算是对工作中遇到的bug的一个总结. bug 这是vs调试状态下,显示的信息.在浏览器端,点击第一次上传按钮,正常,将弹出框关闭后,第二次打开,就会出现问题: 第一次单击上传: 第二次,关闭弹出框,再次单击上传

Easyui+MVC实现动从一个动态弹出框进入另一个动态弹出框

高校平台进行中,本着一个在一个页面完成更多功能的宗旨,在遇到添加功能的多弹出框时,就需要从一个弹出框进入另一个弹出框,因为弹出框是动态的,就是说弹出框中的数据不定,是在Controller中根据传过来的数据动态拼写,完成后再弹出这个弹出框. View中加载部分视图: @*获取分数对话框*@ <form id="fmGetScore"> <div id="dlgGetScore" closed="true" class="