Add button and Textfield programmatically

Hi,
Here is the code how to add the Button or UIButton and TextField or UITextField programmatically


 UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(30, 30, 50, 25)];
 [textField setBorderStyle:UITextBorderStyleLine];
 [self.view addSubview:textField];

  UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
  [button setFrame:CGRectMake(30, 65, 85, 37)];
  [button setTitle:@"Click me" forState:UIControlStateNormal];
  [self.view addSubview:button];

2 comments:

Thanks for sharing as it is an excellent post would love to read your future post
-------------------------------------------------------------------------------
iPhone App Development :: && ::Mobile and Web Application Development

Post a Comment

Powered by Blogger.
Twitter Delicious Facebook Digg Stumbleupon Favorites More