UITextField with image and bottom border
UITextField *txtVideoLink=[[UITextField alloc] initWithFrame:CGRectMake(10, y, SCREEN_WIDTH-20, 50)];
UIView *paddingView3 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 20)];
txtVideoLink.tintColor = [UIColor darkGrayColor];
txtVideoLink.leftView = paddingView3;
txtVideoLink.autocorrectionType = UITextAutocorrectionTypeNo;
txtVideoLink.placeholder=@"Video Link";
NSString *linkType = newsObj.VideoUrl;
if(fromList)
{
if([linkType containsString:@"yt"] || [linkType containsString:@"youtube"])
txtVideoLink.text = newsObj.VideoUrl;
}
txtVideoLink.delegate = self;
txtVideoLink.tag = 3;
txtVideoLink.returnKeyType = UIReturnKeyDone;
txtVideoLink.font=[UIFont fontWithName:AppFont size:fontSize12];
txtVideoLink.keyboardType=UIKeyboardTypeDefault;
//Boarder Bottom Row
CALayer *border3 = [CALayer layer];
border3.borderColor = [UIColor lightGrayColor].CGColor;
border3.frame = CGRectMake(0, txtVideoLink.frame.size.height - borderWidth, txtVideoLink.frame.size.width, txtVideoLink.frame.size.height);
border3.borderWidth = borderWidth;
[txtVideoLink.layer addSublayer:border3];
txtVideoLink.layer.masksToBounds = YES;
UIImageView *imgSearch3=[[UIImageView alloc] initWithFrame:CGRectMake(0, 10, 20, 20)]; // Set frame as per space required around icon
[imgSearch3 setImage:[UIImage imageNamed:@"clipping.png"]];
imgSearch3.backgroundColor = [UIColor clearColor];
[imgSearch3 setContentMode:UIViewContentModeCenter];// Set content mode centre
imgSearch3.contentMode = UIViewContentModeScaleAspectFill;
txtVideoLink.leftView = imgSearch3;
txtVideoLink.leftViewMode=UITextFieldViewModeAlways;
[scrollView addSubview:txtVideoLink];