Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Using Custom UIView In IB

$
0
0

I've created a custom UIView following the recipe here:

http://docs.xamarin.com/recipes/ios/general/templates/using_the_ios_view_xib_template/

If I programmatically add the custom UIView as a subview, it works as expected. If I add it through IB, I get a blank UIView with none of the contained custom items. Is there a way to use these custom UIViews just as other UIViews in IB and have them show up without having to add them programmatically?

Here's the code I have so far:

` using System; using MonoTouch.UIKit; using MonoTouch.Foundation; using MonoTouch.ObjCRuntime; using System.Drawing;

namespace DeclaraMessenger_iPhone { [Register("LoadingUIView")] public partial class LoadingUIView : UIView { public LoadingUIView (IntPtr handle) : base(handle) { Console.WriteLine ("Constructed with ptr..."); }

    public LoadingUIView ()
    {
        var views = NSBundle.MainBundle.LoadNib("LoadingUIView", this, null);
        var view = Runtime.GetNSObject(views.ValueAt(0)) as UIView;
        view.Frame = new RectangleF(0, 0, Frame.Width, Frame.Height);
        AddSubview(view);
    }
}

} `


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>