हैवेन्ट इस कोड का परीक्षण करें, लेकिन आपका प्रश्न काफी सरल है, त्वरित Google आपको परिणाम देगा।
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//first one
UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(45, 30, 200, 40)];
tf.textColor = [UIColor colorWithRed:0/256.0 green:84/256.0 blue:129/256.0 alpha:1.0];
tf.font = [UIFont fontWithName:@"Helvetica-Bold" size:25];
tf.backgroundColor=[UIColor whiteColor];
[email protected]"Hello World";
//second one
UITextField *tf1 = [[UITextField alloc] initWithFrame:CGRectMake(45, tf.frame.origin.y+75, 200, 40)];
tf1.textColor = [UIColor colorWithRed:0/256.0 green:84/256.0 blue:129/256.0 alpha:1.0];
tf1.font = [UIFont fontWithName:@"Helvetica-Bold" size:25];
tf1.backgroundColor=[UIColor whiteColor];
[email protected]"second field";
//and so on adjust your view size according to your needs
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(100, 200, 400, 400)];
[view addSubview:tf];
[view addSubview:tf1];
[self.view addSubview:view];
}
स्रोत
2013-03-28 19:30:19
बस आप किसी भी अन्य वस्तु के साथ करना होगा: 'UITextField * tf = [[UITextField alloc] initWithFrame: फ्रेम];' –
@ H2CO3 लेकिन यह कैसे मैं देखने का एक especific स्थिति पर पाठ क्षेत्र दिखाई डाल सकते हैं नियंत्रक स्क्रीन? –
जैसा कि आप किसी अन्य दृश्य के साथ करेंगे: 'tf.frame = CGRectMake (x, y, w, h);' –