Adding left padding to the UITextField, when add background Image
#import "QuartzCore/QuartzCore.h"
// First import this Framework
......
UITextField *commentTextField = [[UITextField alloc]initWithFrame:CGRectMake(40, 8, 250, 34)];
commentTextField.delegate = self;
commentTextField.placeholder = @"Comment";
[commentTextField setFont:[UIFont boldSystemFontOfSize:12]];
commentTextField.textAlignment = UITextAlignmentLeft;
commentTextField.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 12, 20)];
commentTextField.leftViewMode = UITextFieldViewModeAlways;
commentTextField.background = [[UIImage imageNamed:@"textBox.png"] stretchableImageWithLeftCapWidth:7topCapHeight:17];
[self.view addSubview: commentTextField];
No comments:
Post a Comment