首页 > 其他 > 详细

0914 引用文件文本

时间:2015-09-15 00:00:22      阅读:271      评论:0      收藏:0      [点我收藏+]

显示图片文件时设置显示样式

 [iv setContentMode:UIViewContentModeScaleAspectFit];

有三种样式 fill充满 fit使。。。适应 scale比例规模 aspect方向

1,scaletofill;就算图片变形也要填充满

2,scaleaspectfit 适应这在屏幕上完整显示 有空白

3,scaleaspectfill 填充满屏幕 图不变形 可左右滑动

 

一个显示大量文本的空间 UITEXTVIEW

可添加到uiviewcontroller上

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

tv.text=[nsstring stringwithcontentoffile:path encoding:NSTFU8stringencoding error:nil];

添加到viewcontroller

 

 

 

把文本按照一定的格式拼接 

nsstring *nss1=[nsstring stringwithformat:@“%@ %@ %@ %@“,n,b,a,c];  这是把n,b,a,c四个文本中间加空格拼接 

\n的意思是用换行来拼接

 

把相同间距的文本输出数来

nsarry *ary1=[nss1 componentsseperatedbystring:@“\n”];

这是把以换行符分开的字符串 转换成数组

 

把一个数组中的内容用相同间距的东西装进一个字符串

nsmutablearray *numberarrar;

nsstring *allneirong;

allneirong =[numberarray componentsjoinedbystring:@“\n”];

 

 

引用一个txt文件中的内容(实际就是用一个大的字符串来接受内容)

nsstring *allneirong=[nsstring stringwithcontentoffile:@“users/huangchaojie/desktop/文件.txt” 

encoding:NSUTF8STRINGENCoding error:nil];

 

 

把一段字符串输入某个txt文件保存

[nss1 writetofile:@“users/huangchaojie/desktop/文件.txt” atomically:YES encoding:NSUTF8STRINGEncoding error:nil];

yi

0914 引用文件文本

原文:http://www.cnblogs.com/dieneufhuang/p/4808905.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!