ios6 - Is it possible to create a UITextField in iOS 6 with only a bottom border? -
i want customize uitextfield
in ios 6
transparent text field bottom border.i have found 1 image in stackoverflow earlier,but don't have 10 reputation can't post image,but posting link below.
there multiple ways accomplish this:
create seperatorview , add subview uitextfield y axis height of textfield.
uitextfield *namefield = [[uitextfield alloc] initwithframe:cgrectmake(20,40,70,40) ]; uiview *seperator=[uiview new]; seperator.backgroundcolor = [uicolor graycolor]; seperator.frame =cgrectmake(namefield.frame.origin.x, namefield frame.origin.y+namefield.frame.size.height-1, namefield.frame.size.width,1); [namefield addsubview:seperator];
by using coreanimation class
calayer *bottomborder = [calayer layer]; cgfloat borderwidth = 1; bottomborder.bordercolor = [uicolor graycolor].cgcolor; bottomborder.frame = cgrectmake(0, textfield.frame.size.height - borderwidth, textfield.frame.size.width, textfield.frame.size.height); bottomborder.borderwidth = borderwidth; [textfield.layer addsublayer:border]; textfield.layer.maskstobounds = yes;
by creating custom class uitextfield , overriding drawrect method.
using image , adding backgroundcolor uitextfield.
Comments
Post a Comment