view.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property UITextField *t1,*t2,*t3,*t4,*t5;
@end
view.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.t1=[[UITextField alloc]initWithFrame:CGRectMake(50, 50, 100, 30)];
self.t1.borderStyle=UITextBorderStyleBezel;
self.t1.text=@"naresh";
self.t1.textColor=[UIColor redColor];
self.t1.font=[UIFont italicSystemFontOfSize:10];
self.t1.background=[UIImage imageNamed:@"1.jpg"];
[self.view addSubview:self.t1];
self.t2=[[UITextField alloc]initWithFrame:CGRectMake(50, 100, 100, 30)];
self.t2.borderStyle=UITextBorderStyleLine;
self.t2.text=@"naidu";
self.t2.textColor=[UIColor grayColor];
self.t2.font=[UIFont boldSystemFontOfSize:20];
self.t2.disabledBackground=[UIImage imageNamed:@"1.jpg"];
[self.view addSubview:self.t2];
self.t3=[[UITextField alloc]initWithFrame:CGRectMake(50, 150, 100, 30)];
self.t3.borderStyle=UITextBorderStyleNone;
[self.view addSubview:self.t3];
self.t4=[[UITextField alloc]initWithFrame:CGRectMake(50, 200, 100, 30)];
self.t4.borderStyle=UITextBorderStyleRoundedRect;
self.t4.placeholder=@"name";
self.t4.clearsOnBeginEditing=YES;
self.t4.contentHorizontalAlignment=UIControlContentHorizontalAlignmentCenter;
self.t4.clearButtonMode=UITextFieldViewModeWhileEditing;
self.t4.adjustsFontSizeToFitWidth=YES;
[self.view addSubview:self.t4];
self.t5=[[UITextField alloc]initWithFrame:CGRectMake(50, 250, 100, 30)];
self.t5.borderStyle=UITextBorderStyleRoundedRect;
self.t5.clearsOnInsertion=NO;
self.t5.text=@"name";
self.t5.center=self.view.center;
self.t5.contentVerticalAlignment=UIControlContentVerticalAlignmentFill;
// self.t5.textAlignment=UITextAlignmentCenter; method removed
[self.view addSubview:self.t5];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Sign up here with your email
ConversionConversion EmoticonEmoticon