zoukankan      html  css  js  c++  java
  • Foundation Kit

    1.NSRange

       1:  typedef struct _NSRange
       2:   
       3:  {
       4:   
       5:      unsigned int location;
       6:   
       7:      usingned int length;
       8:   
       9:  }NSRange;
     

    三种创建NSRange的方法:

       1:    1.NSRange range;
       2:   
       3:        range.location = 17;
       4:   
       5:        range.length = 4;
       6:   
       7:    2.NSRange range = {17,4};
       8:   
       9:    3.NSRange range = NSMakeRange(17,4);

    2.NSPoint NSSize NSRect

       1:  typedef struct _NSPoint
       2:  {
       3:    float x;
       4:    float y;
       5:  }NSPoint;
       6:   
       7:  typedef struct _NSSize
       8:  {
       9:    float width;
      10:    float height;
      11:  }NSSize;
      12:   
      13:  typedef struct _NSRect
      14:  {
      15:    NSPoint origin;
      16:    NSSize size;
      17:  }NSRect;

    创建方法:NSMakePoint();NSMakeSize();NSMakeRect();

    //以上几个数据类型不是对象而是struct,原因是因为满足性能需求。

    3.NSString NSMutableString

    创建方法:

       1:  + (id)stringWithFormat:(NSString *)format, ...
       2:   
       3:  NSString *height;
       4:  height = [NSString initWithFormat:@"Your height is %d feet",5];
       5:   

    创建方法:

       1:  NSMutableString *string;
       2:   
       3:  string = [NSMutableString stringWithCapacity:42];

    4.NSArray NSMutableArray

    用来存储Objective-C的对象,而不能存储C语言中的基本数据类型.

    创建方法:

       1:  + (id)arrayWithObjects:(id)firstObj, ...
       2:   
       3:  NSArray *array;
       4:  array = [NSArray arrayWithObjects:@"one",@"two",@"three",nil];
    5.NSEnumerator(Tiger系统)
       1:  NSEnumerator *enumerator
       2:  enumerator = [array objectEnumerator];
       3:   
       4:  id thingie;
       5:  while(thingie = [enumerator nextObject])
       6:  {
       7:      NSLog(@"i found %@",thingie);
       8:  }
    5.1快速枚举
       1:  for(NSString *string in array)
       2:  {
       3:      NSLog(@"i found %@",string);
       4:  }

    6.NSDictionary

    创建方法:

    +(id)dictionaryWithObjectAndKeys:(id)fristObject,...;

    添加元素:

    -(void)setObject:(id)anObject forkey:(id)akey;

    (fuck!!写到这,windows live writer报错,后面写的都没保存…)

    7.NSNumber

    8.NSValue

    9.NSNull



    Wangkeke 2012-04-22 16:58 发表评论
  • 相关阅读:
    luogu P4284 [SHOI2014]概率充电器 期望 概率 树形dp
    luogu P5161 WD与数列 SAM 线段树合并 启发式合并
    5.5 省选模拟赛 B Permutation 构造 贪心
    luogu P3761 [TJOI2017]城市 树的直径 bfs
    一本通 1783 矩阵填数 状压dp 容斥 计数
    CF R638 div2 F Phoenix and Memory 贪心 线段树 构造 Hall定理
    BSOJ 5445 -- 【2018雅礼】树 prufer序列 dp
    CF1037H Security 线段树合并 SAM
    c++11の顺序容器
    c++11の关联容器
  • 原文地址:https://www.cnblogs.com/cokecoffe/p/2537111.html
Copyright © 2011-2022 走看看