Objective-C: UIButton has image basket with counter in circle.
This example help you to show counter in basket. You can use it simply.
You can use one of variants:
Example 1:
- BasketButton inherit from UIButton
- Use Custom Class BasketButton in storyboard in UIButton-view
- Include this in your code:
@property (nonatomic, weak) IBOutlet BasketButton *basket1;
- (IBAction) basketButtonClick1:(id)sender {
self.calc1++;
[self.basket1 updateCounter:self.calc1];
}
Example 2:
- You have to import extension
- Include this in your code:
#import "UIButton+Counter.h"
@property (nonatomic, weak) IBOutlet UIButton *basket2;
- (IBAction) basketButtonClick2:(id)sender {
self.calc2++;
[self.basket2 updateCounter:self.calc2];
}