iOS-Foundation各种NS
NSRange range = NSMakeRange(2, 4);//location=2,len=4
// NSMutableString可变字符串
NSMutableString *s1 = [NSMutableString stringWithFormat:@"age is 10"];
[s1 appendString:@"love"];
[s1 deleteCharactersInRange:range];
//类方法构造字符串
NSString *str = [NSString stringWithFormat:@"age is %d",10];
NSString *str1 = [NSString stringWithContentsOfURL:url
encoding:NSUTF8StringEncoding error:nil];
NSString *str1 = [[NSString alloc]initWithContentsOfFile:@"/Users/zhangct/Desktop/1.txt"encoding:NSUTF8StringEncoding error:nil];
NSString *str2 = [[NSString alloc]initWithContentsOfURL:urlencoding:NSUTF8StringEncoding error:nil];
[str2 writeToFile]
NSDictionary *dict = @{@"name": @"zhangct", @"age": @20};
NSNumber *num1 = [NSNumber numberWithInt:10];
[num1 intValue];
[num2 floatValue];
int age = 20;
num3 = @(age);
num3 = @100;
CGPoint p = CGPointMake(10, 20);
NSValue *value = [NSValue valueWithPoint:p];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyy年MM月dd日 HH时mm分ss秒";
[self performSelector:@selector(onClick:value1:) withObject:nil withObject:nil];
performSelector是执行self对象中的onClick:value1:方法,最多支持传递2个参数.
//播放完毕后延迟1秒执行释放内存
[self.tom performSelector:@selector(setAnimationImages:)
withObject:nil afterDelay:self.tom.animationDuration + 1.0f];
[self setValue:dict[@"title"] forKey:@"title"];
//当xib文件加载完毕后执行
//根据分组和行号初始化对象
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:10 inSection:0];
indexPath.section
iOS-Foundation各种NS的更多相关文章
- iOS Foundation 框架概述文档:常量、数据类型、框架、函数、公布声明
iOS Foundation 框架概述文档:常量.数据类型.框架.函数.公布声明 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业 ...
- iOS Foundation 框架基类
iOS Foundation 框架基类 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致"创作公用协议 转 ...
- iOS Foundation框架 -2.常用集合类简单总结
Foundation框架中常用的类有:NSString.NSArray.NSSet.NSDictionary 以及它们对应的子类 NSMutableString.NSMutableArray.NSMu ...
- iOS Foundation框架简介 -1.常用结构体的用法和输出
1.安装Xcode工具后会自带开发中常用的框架,存放的地址路径是: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.plat ...
- iOS Foundation框架 -1.常用结构体的用法和输出
1.安装Xcode工具后会自带开发中常用的框架,存放的地址路径是: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.plat ...
- IOS - Foundation和Core Foundation掺杂使用桥接
Foundation和Core Foundation掺杂使用桥接 Toll-Free Bridging 在cocoa application的应用中,我们有时会使用Core Foundation(CF ...
- iOS Foundation框架 -3.利用NSNumber和NSValue将非OC对象类型数据存放到集合
1.Foundation框架中提供了很多的集合类如:NSArray,NSMutableArray,NSSet,NSMutableSet,NSDictionary,NSMutableDictionary ...
- iOS - Foundation相关
1.NSString A.创建的方式: stringWithFormat:格式化字符串 ,创建字符串对象在堆区域 @"jack& ...
- iOS Foundation框架 -4.NSDate类的简单用法
NSDate为日期时间类对象,简单操作: 注意:直接NSLog输出NSDate对象,默认是以0时区为标准,因此会比北京时间少8小时 1.将Date格式转换为自定义格式的字符串格式 // 自定义Date ...
- IOS Note - Core NS Data Types
NSString (Immutable)NSMutableString (rarely used)NSNumberNSValueNSData (bits)NSDateNSArray (Immutabl ...
随机推荐
- pygame游戏图像绘制及精灵用法
1精灵文件 plane_sprites.py import pygame class GameSprite(pygame.sprite.Sprite): """飞机大战游 ...
- javascript权威指南第21章 Ajax和Comet
function createXHR(){ if(typeof XMLHttpRequest !='undefined'){ return new XMLHttpRequest(); }else if ...
- 转,sql 50道练习题
SQL语句50题 -- 一.创建教学系统的数据库,表,以及数据 --student(sno,sname,sage,ssex) 学生表--course(cno,cname,tno) 课程表--sc( ...
- 用免费的webservice查询天气
亲测能用URL地址:https://blog.csdn.net/qq_37171353/article/details/79415960 wsimport -s . file:///D:weath.w ...
- Cogs 12. 运输问题2(有上下界的有源汇最大流)
运输问题2 ★★☆ 输入文件:maxflowb.in 输出文件:maxflowb.out 简单对比 时间限制:1 s 内存限制:128 MB 运输问题 [问题描述] 一个工厂每天生产若干商品,需运输到 ...
- linux系列(十二):more命令
1.命令格式: more [-dlfpcsu ] [-num ] [+/ pattern] [+ linenum] [file] 2.命令功能: more命令和cat的功能一样都是查看文件里的内容,但 ...
- linux环境下固定ip操作
背景: 使用虚拟机管理软件VMvare workstation 安装好liunx虚拟机(centos)成功,下面为了固定linux的ip进行一系列设置 参考的文件有部分不是很详细,在借鉴它的基础上进行 ...
- scrapy框架自定制命令
写好自己的爬虫项目之后,可以自己定制爬虫运行的命令. 一.单爬虫 在项目的根目录下新建一个py文件,如命名为start.py,写入如下代码: from scrapy.cmdline import ex ...
- Ubuntu 源 (ros)
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse deb http://archive. ...
- HDU 4609 3-idiots ——(FFT)
这是我接触的第一个关于FFT的题目,留个模板. 这题的题解见:http://www.cnblogs.com/kuangbin/archive/2013/07/24/3210565.html. FFT的 ...