xamarin.ios - Custom controls not visible in the View -
below code used create custom uitextfield in code behind.
uitextfield usernamefield;
usernamefield = new uitextfield
{
placeholder = "enter username",
borderstyle = uitextborderstyle.roundedrect,
frame = new rectanglef(10, 32, 50, 30)
};
view.addsubview(usernamefield);
but when run app, dont see anywhere. not control controls create in code behind. if drag controls toolbox onto view it's working fine. might cause?
make sure container view not transparent alpha = 1 , set background colors appropriate controlls. because default set clear
you can use method easly set background , rounded corners in older versions of ios
public static void makeviewrounded(uiview view,float cornerradius, monotouch.coregraphics.cgcolor backgroundcolor) { view.layer.cornerradius = cornerradius; view.layer.backgroundcolor = backgroundcolor; }
also make sure adding custom controll viewcontroller/view
Comments
Post a Comment