Quantcast
Channel: Xamarin.Mac — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 1429

How to get user defined runtime attributes from xcode ?

$
0
0

Hi All,

I am trying to implement custom NSButton to make my button pretty. Here is my custom class

    [Foundation.Register("StyleAButton")]
    public class StyleAButton : NSButton
    {
          private NSColor _backgroundNormalColor;
          private NSColor _backgroundHighlightColor;

          public StyleAButton(IntPtr handle) : base(handle)
          {
               Initialize();
          }

          [Export("initWithCoder:")]
          public StyleAButton(NSCoder coder) : base(coder)
          {
               Initialize();
          }

          public void Initialize()
          {
               Layer = new CALayer();
               _buttonBase = new StyleAButttonBase(this);
          }

          [Export("BackgroundHighlightColor")]
          public NSColor BackgroundHighlightColor
          {
                get { return _backgroundHighlightColor; }
                set
                    {
                        _backgroundHighlightColor = value;
                        DidChangeValue("BackgroundHighlightColor");
                    }
          }

         [Export("TitleNormalColor")]
         public NSColor TitleNormalColor
         {
               get { return _titleNormalColor; }
               set
                   {
                      _titleNormalColor = value;
                      _buttonBase.SetTitleColor();
                     DidChangeValue("TitleNormalColor");
                   }
          }
    }

in xcode interface i am setting this class to NSButton and gave some user defined runtime attributes
but i am getting transparent background color for my button after running the project :( Am I missing anything ?????


Viewing all articles
Browse latest Browse all 1429

Trending Articles