// CPL - Added new flashy PBs
button=[[UIAdvancedButton alloc] initWithFrame:CGRectMake(10, 180, 80, 38) text:@"Peet's" cornerRadius:10.0 buttonStyle:UIAdvancedButtonStyleGloxyGray hasShadow:YES hasGlow:YES];
[self.button setTextFont:[UIFont boldSystemFontOfSize:18] textColor:nil];
UITapGestureRecognizer *tapButton = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushBack:)]; //pushBack is method that we want to perform
[self.button addGestureRecognizer:tapButton];
[self.view addSubview:self.button];
[self.button release];
Pages
▼
Saturday, October 27, 2012
UIButton configuration programmatically
The UIAdvancedButton class needs to be programmed without Interface Builder (IB) as can be seen below. The Button is alloc/inited and then a UIGestureRecognizer is attached to it so that it can call the proper method when tapped. Don't forget to add the property & @synthesize it.