Today I’m going to talk about a simple badge view, which can be applied, to any view. You can simply create object of "AyalBadgeView" with the parent view, which you want to display the badge number and the location of the badge number.
Let's see the how to use the "AyalBadgeView".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIButton *buttionTwo = [UIButton buttonWithType:UIButtonTypeCustom]; | |
buttionTwo.frame = CGRectMake(100, 150, 150, 40); | |
buttionTwo.backgroundColor = [UIColor grayColor]; | |
[buttionTwo setTitle:@"My Button" forState:UIControlStateNormal]; | |
[self.view addSubview:buttionTwo]; | |
AyalBadgeView *ayalBadgeViewButton = [[AyalBadgeView alloc] initWithFrame:CGRectMake(140, -10, 16, 16) parentView:buttionTwo]; | |
ayalBadgeViewButton.badgeNumber = 8; |
You can download the github project "AyalBadgeView" from this location and use it in your projects.