Friday, May 11, 2012

iPhone Button create


Here we can add this code in your xcode for creating Button Programmatically, 


 UIButton *btn = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
 btn.frame = CGRectMake(230, 39, 73, 40) ;
 btn.titleLabel.font = [UIFont boldSystemFontOfSize:15];
 [btn setBackgroundImage:[UIImage imageNamed:@"1.png"] forState:UIControlStateNormal];
 [btn addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
 [btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];\
 [self.view addSubview:btn];
 [btn release];

No comments:

Post a Comment