文科的格调 + 工科的背景 = 爱浪漫的程序媛





Hi Friends,

This way works without any warnings. We are not using Undocumented calls but creating similar UI.


// Ask for Username and password.

UIAlertView *alertview = [[UIAlertView alloc] initWithTitle:@”Twitter Details!” message:@”n n n” delegate:self cancelButtonTitle:@”Cancel” otherButtonTitles:@”OK”, nil];

// Adds a username Field

UITextField *utextfield = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)]; 

utextfield.placeholder = @”Username”;

[utextfield setBackgroundColor:[UIColor whiteColor]];

 [alertview addSubview:utextfield];

// Adds a password Field

UITextField *ptextfield = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 80.0, 260.0, 25.0)]; ptextfield.placeholder = @”Password”;

[ptextfield setSecureTextEntry:YES];

[ptextfield setBackgroundColor:[UIColor whiteColor]]; [alertview addSubview:ptextfield];

// Move a little to show up the keyboard

CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0, 80.0);

[alertview setTransform:transform];

// Show alert on screen.

[alertview show];

[alertview release];


// Don’t forget to release these after getting their values

[utextfield release];

[ptextfield release];


电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.