Title = * NSString @ " have to say YYKit third-party frameworks really cattle, YYLabel quite powerful in rich text display and operational aspects, particularly its asynchronous rendering, allowing the interface to be more fluent how smooth, here we introduce a simple to use " ; // YYLabel rich text YYLabel titleLabel * = [YYLabel new new ]; // asynchronous rendering huge amount of text displayed when a label when you can clearly feel the power of this feature titleLabel.displaysAsynchronously = YES; [self.view addSubView: the titleLabel]; titleLable.numOfLines = 0 ; YYTextContainer * titleContarer = [YYTextContainer new new ]; // limiting width detailContarer.size = CGSizeMake ( 100 , CGFLOAT_MAX); NSMutableAttributedString *titleAttr = [self getAttr:title]; YYTextLayout *titleLayout = [YYTextLayout layoutWithContainer:titleContarer text:titleAttr]; CGFloat titleLabelHeight = titleLayout.textBoundingSize.height; titleLabel.frame = CGRectMake(50,50,100,titleLabelHeight);
- (NSMutableAttributedString *) getAttr: (NSString * ) AttributedString { NSMutableAttributedString * resultAttr = [[NSMutableAttributedString the alloc] initWithString: AttributedString]; // alignment is herein aligned with the edges resultAttr.yy_alignment = NSTextAlignmentJustified; // set the line spacing resultAttr.yy_lineSpacing = 5 ; // set the font size resultAttr.yy_font = [UIFont systemFontOfSize: CONTENT_FONT_SIZE]; // may be provided a certain font size // [resultAttr yy_setFont: [UIFont boldSystemFontOfSize: CONTENT_FONT_SIZE] Range: NSMakeRange (0,. 3)]; / /Set character spacing // resultAttr.yy_kern = [the NSNumber numberWithFloat: 1.0]; return resultAttr; }
1.yylable automatic layout setting the maximum width to wrap the
2.yylable click event
3.yylable Add a picture