c# - MonoTouch.Dialog:部分中的 GlassButton

标签 c# ios xamarin.ios uibutton monotouch.dialog

我有一个标准的 DialogViewControler,它添加了一个 Section 和一个 View 作为构造函数:

Section sec = new Section (new LogoHeaderView (320, 87));

LogoHeaderView 我添加了一个 MT.Dialog GlassButton

        btnContact = new GlassButton (frameContact);    
        btnContact.SetTitle ("Contact", UIControlState.Normal);
        btnContact.NormalColor = Settings.ButtonNormalColor;
        btnContact.HighlightedColor = Settings.ButtonHighlightColor;
        btnContact.Tapped += (obj) => {};
        btnContact.Enabled=true;
        AddSubview (btnContact);

View 呈现得很好,但是按钮不可点击并且 Tapped 事件永远不会激活。好像没有启用?

如何让 GlassButton 出现在部分的 View 中并像按钮一样工作? enter image description here

最佳答案

它对我有用。但是,如果您的 GlassButton 超出了您的 UIView 限制,它将不会接收点击事件(这是一个 UIView 而不是 GlassButton 问题)。

例如这不起作用

        UIView view = new UIView (new RectangleF (0, 0, 200, 10));
        view.MultipleTouchEnabled = true;
        GlassButton gb = new GlassButton (new RectangleF (10,10,100,100));
        gb.SetTitle ("Contact", UIControlState.Normal);
        gb.Enabled = true;
        gb.Tapped += delegate {
             Console.WriteLine ("hello");
        };
        view.AddSubview (gb);

但是把第一行改成:

        UIView view = new UIView (new RectangleF (0, 0, 200, 200));

然后您就可以点击按钮了。

关于c# - MonoTouch.Dialog:部分中的 GlassButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8608773/

相关文章:

xamarin.ios - 如何在iOS中使用 'Container View'? ( Storyboard)

xamarin - 使用 UIDocumentInteractionController 预览文档在 iOS 13 中不起作用

c# - 合并两个List <T>的最简单方法

c# - 不要使用 Type.GetMethods() 返回 ToString、Equals、GetHashCode、GetType

C# 主窗体实现接口(interface)

ios - 如何让应用程序在 iPod 2nd gen 上运行

c# - 使用 分配委托(delegate)时出错? : Syntax

ios - 如何定位一个SCNNode来覆盖整个SCNView?

渲染音频单元时 iOS 准确的 AudioTimeStamp

.net - 线程的 MonoTouch 测试