objective c - How to set UITextField border/CALayer border ios on three sides only -
try these.. hope helps...
uitextfield *txt=[[uitextfield alloc]initwithframe:cgrectmake(10, 100, 150, 30)]; [txt setbackgroundcolor:[uicolor clearcolor]]; [txt setplaceholder:@"hello friend"]; [self.view addsubview:txt]; calayer *border = [calayer layer]; cgfloat borderwidth = 2; border.bordercolor = [uicolor redcolor].cgcolor; border.frame = cgrectmake(0, -2, txt.frame.size.width, txt.frame.size.height); border.borderwidth = borderwidth; [txt.layer addsublayer:border]; txt.layer.maskstobounds = yes;
Comments
Post a Comment