• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ios - IOS8 Xamarin 替换中带有 Datepicker 的 UIActionSheet

[复制链接]
菜鸟教程小白 发表于 2022-12-13 09:34:57 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我已经准备好对 Xamarin IOS 项目(我完全是新手)进行一些更改,但我很快发现我们的项目无法正常工作。

            // save our uiview owner
        this._owner = owner;

        // configure the title label
        _titleLabel.BackgroundColor = UIColor.Clear;
        _titleLabel.TextColor = Colors.backgroundcolor;
        _titleLabel.Font = Fonts.HelveticaNeueLight();

        // configure the done button
        _doneButton.SetTitle("OK", UIControlState.Normal);
        _doneButton.TouchUpInside += (s, e) => { _actionSheet.DismissWithClickedButtonIndex(0, true); };
        _doneButton.SetTitleColor(Colors.backgroundcolor, UIControlState.Normal);
        _doneButton.SetFont(eFontType.HelveticaNeue_Light, 14);

        // create + configure the action sheet
        _actionSheet = new UIActionSheet() { Style = UIActionSheetStyle.BlackTranslucent };
        _actionSheet.Clicked += (s, e) => { Console.WriteLine("Clicked on item {0}", e.ButtonIndex); };

        // add our controls to the action sheet
        _actionSheet.AddSubview(picker);
        _actionSheet.AddSubview(_titleLabel);
        _actionSheet.AddSubview (_doneButton);

^这就是它的创建方式,并添加了一些标签、按钮和日期选择器。 我们使用 UIActionSheet 来显示 Datepicker。但正如我所见,IOS8 不再支持这种方式来处理它了。 而且我不知道如何让它与 UIAlertController 一起工作 - 我找不到任何好的例子。



Best Answer-推荐答案


请参阅 Xamarin 论坛 iOS 8 Datepicker 中的此帖子

引用,

Now the Actionsheet can't add Subviews anymore

所以这里有一个 Github 链接,用于替换 ActionSheet Datepicker。我刚刚在我的应用程序中实现了这一点,并且运行良好。 Github Replacement

在论坛帖子中,有一个逐步链接可集成到您的项目中。

关于ios - IOS8 Xamarin 替换中带有 Datepicker 的 UIActionSheet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26377329/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap