Pages

Sunday, May 30, 2010

Iphone: Alert View 2

Here we learn other things related to the UIAlertView Of iphone Application:


  • Alter View with multiline Button:
  • Alter View with Text field:






Alter View with multiline Button:
By default, if Alert has Three Button then its Come in Three line as

UIAlertView *alert = [[UIAlertView alloc] 
  initWithTitle:@"kamal " 
  message:@"Good Bye......." 
  delegate:self cancelButtonTitle:@"Cancel" 
  otherButtonTitles:@"hi", @"Hello ", nil]; 
    [alert show];


But If We Want to display Two Button with two different line then use below statement only before alert Show:
[alert setNumberOfRows:2];


Alter View with Text field:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Send Email" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Send", nil];
CGRect frame = CGRectMake(14, 35, 255, 23);
UITextField *emailField = [[UITextField alloc] initWithFrame:frame];
emailField.borderStyle = UITextBorderStyleBezel;
emailField.textColor = [UIColor blackColor];
emailField.textAlignment = UITextAlignmentCenter;
emailField.font = [UIFont systemFontOfSize:14.0];
emailField.placeholder = @"";
emailField.backgroundColor = [UIColor whiteColor];
emailField.autocorrectionType = UITextAutocorrectionTypeYes; // no auto correction support
emailField.keyboardType = UIKeyboardTypeEmailAddress; // use the default type input method (entire keyboard)
emailField.returnKeyType = UIReturnKeyDone;
emailField.delegate = self;
emailField.clearButtonMode = UITextFieldViewModeWhileEditing; // has a clear 'x' button to the right
[alert addSubview:emailField];
[alert show];
[alert release];



Thanks

Keep smiling  and Happy Programming.

No comments:

Post a Comment