虽然说一个普通的button上面有推送红点的技术已经很成熟了,但是我想记录下来,以便今后使用。
ButtonIcon.h
#import <UIKit/UIKit.h>
@interface ButtonIcon : UIView
@property(nonatomic,strong)UIImageView * redImage;//九宫格红点
@property(nonatomic,strong)UIButton * button;
/**
* buttonIcon设置
*/
-(void)buildButtonIcon:(UIImage *)buttonNomalImage
withButtonHLImage:(UIImage *)hightLightImage
withFramH:(NSInteger)length;
/**
* 红点隐藏
*/
-(void)buttonIconHideRedImage;
/**
* 红点出现
*/
-(void)buttonIconShowRedImage:(NSString *)noticeNum;
@end
ButtonIcon.m
#import "ButtonIcon.h"
@implementation ButtonIcon
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
-(void)buildButtonIcon:(UIImage *)butto