0914 referencing file text

Source: Internet
Author: User

Set display style when displaying picture files

[IV Setcontentmode:uiviewcontentmodescaleaspectfit];

There are three styles of fill filled with fit to make ... Adjusting scale aspect direction

1,scaletofill, even if the picture is distorted, fill it with

2,scaleaspectfit fit this full display on the screen has blank

3,scaleaspectfill fill the screen picture without distortion can slide left and right

A space for displaying large amounts of text Uitextview

Can be added to the Uiviewcontroller

Uitextview *tv=[[uitextview Alloc]initwithframe:self.view.bounds];

Tv.text=[nsstring Stringwithcontentoffile:path encoding:nstfu8stringencoding Error:nil];

Add to Viewcontroller

To stitch the text in a certain format

NSString *nss1=[nsstring stringwithformat:@ "%@%@%@%@", n,b,a,c]; This is the N,b,a,c four text in the middle plus a space splicing

\ n means to splice with a newline.

The text output of the same spacing

Nsarry *ary1=[nss1 componentsseperatedbystring:@ "\ n"];

This is to convert a string separated by a newline character into an array

Load the contents of an array into a string with something of the same spacing

Nsmutablearray *numberarrar;

NSString *allneirong;

Allneirong =[numberarray componentsjoinedbystring:@ "\ n"];

Referencing the contents of a TXT file (actually accepting the content with a large string)

NSString *allneirong=[nsstring stringwithcontentoffile:@ "users/huangchaojie/desktop/file. txt"

Encoding:nsutf8stringencoding Error:nil];

Enter a string into a TXT file to save

[Nss1 writetofile:@ "users/huangchaojie/desktop/file. txt" Atomically:yes encoding:nsutf8stringencoding Error:nil];

Yi

0914 referencing file text

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.