[Code Note] sets the row spacing method of textView or label, textviewlabel

Source: Internet
Author: User

[Code Note] sets the row spacing method of textView or label, textviewlabel

I ,.

Ii. Code.

RootViewController. m

-(Void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. // UILabel * label = [[UILabel alloc] initWithFrame: CGRectMake (50,100,200,300)]; label. backgroundColor = [UIColor orangeColor]; label. text = @ "in 3000 BC, the number of residents in the Indian River Basin was widely used, and the residents adopted the decimal calculation method. To the Veda age (1500-BC ~ In 500 BC), yalian people realized the role of numbers in production activities and daily life and created some simple and incomplete figures. In the 3rd century BC, a set of numbers appeared in India, but different languages were written. The most typical of them was Brahman. Its uniqueness was from 1 ~ 9 each number has a special symbol, and modern numbers are born from them. At that time, "0" had not yet appeared. In the age of multiple regions (300 ~ In 500, "0" was available, called "Shun RuO" (shunya), indicating that the method was a black spot "●", and then evolved into "0 ". In this way, a complete set of numbers is generated. This labor creation has also made great contributions to the world culture. "; Label. numberOfLines = 0; [self. view addSubview: label]; // set the row spacing NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init]; paragraphStyle. lineSpacing = 50; NSDictionary * attributes = @ {NSFontAttributeName: [UIFont systemFontOfSize: 14], NSParagraphStyleAttributeName: paragraphStyle}; label. attributedText = [[NSAttributedString alloc] initWithString: label. text attributes: attributes];}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.