• Several methods of dynamically adjusting the height of uilabel in IOS


    brief introduction The uilabel class implements a read-only text view. You can use this class to draw one or more lines of static text, for example, you may use other parts of the user interface identified. The uilabel class supports both simple and complex styles of label text, and can also control the appearance, such […]

  • Uilabel in IOS sets top, center, bottom and text top display


    Uilabel is set to align top, center and bottom in IOS In IOS, the default text in uilabel can only be aligned in the middle in the vertical direction. Bloggers refer to foreign websites and inherit a new class from uilabel to achieve top alignment, center alignment and bottom alignment. The details are as follows: […]

  • Common properties of uilabel: summary of IOS development


    1. Text: set label display text. 2. Attributedtext: set label attribute text. IOS code NSString *text = @”first”; NSMutableAttributedString *textLabelStr = [[NSMutableAttributedString alloc] initWithString:text]; [textLabelStr setAttributes:@{NSForegroundColorAttributeName : [UIColor lightGrayColor], NSFontAttributeName : [UIFont systemFontOfSize:17]} range:NSMakeRange(11, 10)]; label.attributedText = textLabelStr; 3. Font: set label text font. The default font size is 17. IOS code label.font = [UIFontsystemFontOfSize:17] […]

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


    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


    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]; […]