OGeek|极客世界-中国程序员成长平台

标题: ios - IOS8 Xamarin 替换中带有 Datepicker 的 UIActionSheet [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 09:34
标题: ios - IOS8 Xamarin 替换中带有 Datepicker 的 UIActionSheet

我已经准备好对 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/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4