Ios is similar to the red dot display function, and ios is similar to the display function.
Design Concept: Add a category to UIView. All views can be highlighted in red as needed.
# Import <UIKit/UIKit. h> @ interface UIView (CHRRedDot) @ property (readonly, nonatomic) CALayer * chr_redDotLayer;/** the distance between the center of the red dot and each edge. If the distance is <= 0, the distance */@ property (nonatomic, assign) UIEdgeInsets chr_redDotEdgeInsets;/** indicates the radius of the red dot. The default value is 4 */@ property (nonatomic, assign) CGFloat chr_redDotRadius;/** the color of the red dot. The default value is 0xFF5A5A */@ property (nonatomic, strong) UIColor * chr_redDotColor;/** whether the red dot displays */@ property (nonatomic, assign) BOOL chr_redDotShow; @ end # pragma mark-method-(void) chr_updateRedDot {CALayer * redDot = self. chr_redDotLayer; if (self. chr_r EdDotShow) {if (redDot = nil) {redDot = [CALayer layer]; self. chr_redDotLayer = redDot; [self. layer addSublayer: redDot];} redDot. backgroundColor = self. chr_redDotColor.CGColor; [self chr_layoutRedDot];} else {[redDot removeFromSuperlayer]; self. chr_redDotLayer = nil; }}- (void) chr_layoutRedDot {CALayer * redDot = self. chr_redDotLayer; if (redDot = nil) return; CGFloat radius = self. chr_redD OtRadius; redDot. cornerRadius = radius; UIEdgeInsets edgeInsets = self. chr_redDotEdgeInsets; CGFloat originX sets = edgeInsets. right <= 0? EdgeInsets. left-radius: self. bounds. size. width-edgeInsets. right + radius; CGFloat originY = edgeInsets. bottom <= 0? EdgeInsets. top-radius: self. bounds. size. height-edgeInsets. bottom + radius; CGFloat length = radius * 2; redDot. frame = CGRectMake (originX, originY, length, length );}