Monday 21 April 2014

Adding left padding to the UITextField, when add background Image


 Adding left padding to the UITextField, when add background Image


#import "QuartzCore/QuartzCore.h"  
  // First import this Framework
......

UITextField *commentTextField = [[UITextField alloc]initWithFrame:CGRectMake(40825034)];
    commentTextField.delegate = self;
    commentTextField.placeholder = @"Comment";
    [commentTextField setFont:[UIFont boldSystemFontOfSize:12]];
    commentTextField.textAlignment = UITextAlignmentLeft;
    commentTextField.leftView = [[UIView allocinitWithFrame:CGRectMake(001220)];
    commentTextField.leftViewMode = UITextFieldViewModeAlways;
    commentTextField.background = [[UIImage imageNamed:@"textBox.png"stretchableImageWithLeftCapWidth:7topCapHeight:17];
    [self.view addSubview: commentTextField];

No comments:

Post a Comment