I want to know how can i set a badge to UIButton like UITabBarController Badge?
Asked
Active
Viewed 1,752 times
2
-
See the answers to [this question][1] on SO [1]: http://stackoverflow.com/questions/4722669/how-can-i-add-a-badge-to-a-standard-uibutton – FluffulousChimp Mar 12 '12 at 21:15
2 Answers
0
You just want to add a background image to a button
UIImage *image = [UIImage imageNamed:@"YourBadge.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(200.0, 10.0, 20.0, 20.0); // or whatever dimensions you want
[button setBackgroundImage:image forState:UIControlStateNormal];

Peter Kelly
- 14,253
- 6
- 54
- 63