Tag:uilabel

  • Solution to the problem of text jumping of timer displayed in uilabel

    Time:2019-11-29

    Let’s first look at a problematic display effect: The GIF graph above will find that there is a problem of jitter and flicker when the verification code count is displayed. At present, most of the controls used to implement timer display are uilabel. Before IOS 9, the default English font was Helvetica, in which the […]

  • IOS Implements Edge-adding Function of Text Based on UILabel

    Time:2019-6-15

    It can achieve the effect of black edge in the text description. After inheriting UILabel, overload drawTextInRect: – (void)drawTextInRect:(CGRect)rect { CGSize shadowOffset = self.shadowOffset; UIColor *textColor = self.textColor; CGContextRef c = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(c, 1); CGContextSetLineJoin(c, kCGLineJoinRound); CGContextSetTextDrawingMode(c, kCGTextStroke); self.textColor = [UIColor whiteColor]; [super drawTextInRect:rect]; CGContextSetTextDrawingMode(c, kCGTextFill); self.textColor = textColor; self.shadowOffset = CGSizeMake(0, 0); [super drawTextInRect:rect]; […]