In order to add an editable text box. E.g.: To ask the username, use the next code:

UITextField* textField = [[UITextField alloc] initWithFrame:CGRectMake(100, 200, 300, 50)];
textField.delegate = self;
textField.placeholder = @"<Enter Your Username>";
textField.textAlignment = UITextAlignmentCenter;
[self.view addSubview: textField];
[textField release];

And add the delegate <UITextFieldDelegate> to your viewController:
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
	//Do something with textField.text;
	[textField resignFirstResponder];

    return YES;
}

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2011 W2OM - iPhone by code Suffusion theme by Sayontan Sinha