`
xjk112
  • 浏览: 10351 次
  • 性别: Icon_minigender_2
  • 来自: 上海
社区版块
存档分类
最新评论

int NSInteger NSNumber

    博客分类:
  • ios
 
阅读更多

look down

 

 #if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif

 

you usually want to use NSInteger when you don't konw what kind of processor architechture your code might run on,so you may for som reason, want the largest possible int type, which on 32 bit system is just an int, whileon a 64-bit system it's a long;

so i 'd stick with using NSInteger instead of int / long Unless you specifically require them;

 

 

2013 12-13

分享到:
评论

相关推荐

    ios 在一定范围随机选取demo

    + (NSNumber *)randomNumberInRange:(NSInteger)minValue maxValue:(NSInteger)maxValue; @end @implementation NSNumber (Random) + (NSNumber *)randomNumberInRange:(NSInteger)minValue maxValue:(NSInteger)...

    AZFMDB:您可以快速方便地使用sqllite开发您的应用程序

    AZFMDB u can fast and convenient use sqllite to develop ...* 支持 bool, int, float, NSInteger, NSUInteger, CGFloat, NSTimeInterval, @"NSNumber",@"NSDictionary",@"NSMutableDictionary",@"NSArray",@"NSMuta

    IOS 64 位编程建议以及静态库支持armv7s

    为了避免这类问题,应使用iOS SDK提供的类型,如`NSInteger`、`NSUInteger`、`CGFloat`和`NSTimeInterval`,它们会根据目标架构自动调整大小。避免使用`sizeof`来依赖特定的字节数,因为这可能导致意外的行为。 2. ...

    使用核心数据最简单的方法

    特点:自定义 primaryKey,目前支持 NSString,NSInteger(int_64,int_32,int_16),NSNumber JSON(NSDictionary) -> NSManageObject(In theory,support any KVC object)JSONs(NSArray) -> NSManageObject(s)安全...

    IOS 职位面试问题及答案

    - **`NSInteger`与`int`的区别**:`NSInteger`是一个类型别名,而不是`NSNumber`的子类。它根据系统的位数(32位或64位)自动选择合适的类型(`int`或`long`),从而提供更广泛的整数范围支持。 #### 六、对象...

    iosiOS面试宝典

    - `NSInteger`是`int`或`long`的别名,根据操作系统(32位或64位)自动调整大小。 #### 八、id声明的对象特性 - **id**: 表示可以指向任何Objective-C对象的通用指针类型。 #### 九、Objective-C内存管理 - **ARC...

    IOS苹果开发面试宝典2018

    - **NSInteger vs int**:`NSInteger` 是`int` 或 `long` 的别名,根据系统架构(32位或64位)来确定其具体类型。 #### 7. id声明的对象 - **特性**:`id` 是Objective-C中的通用对象指针类型,可以指向任何...

    ios_assign,retain和copy详解

    assign用于基本数据类型(如NSInteger, CGFloat)或者C数据类型(如int, float, double等),以及非Objective-C对象(如Core Foundation对象)。当使用assign关键字声明属性时,setter方法会直接进行赋值操作,不会...

    iOS面试大全.docx

    - `NSInteger`是根据平台(32位或64位)选择合适长度的整型(`int`或`long`),提供了更好的平台兼容性。 7. **id类型**: - `id`可以指向任何Objective-C对象,具备运行时的动态特性,允许灵活地处理不同类型的...

    objective-c-II

    基础数据类型如int、float等可以通过包装在结构体(如NSInteger和NSNumber)中变为对象。类是定义对象行为和属性的蓝图,而实例则是根据类创建的对象。Objective-C支持类的继承,允许子类继承父类的属性和方法,并...

    IOS 开发之ObjectiveC的变量类型的字符代表

    - NSInteger:在32位系统中为int(字符`i`),在64位系统中为long(字符`l`或`L`)。 - NSUInteger:在32位系统中为unsigned int(字符`I`),在64位系统中为unsigned long(字符`q`)。 在给出的代码示例中,使用...

    ios面试题目

    `NSInteger`是根据平台(32位或64位)选择`int`或`long`,提供跨平台的整数类型。 7. **id类型**: - `id`可以指向任何Objective-C对象,体现了Objective-C的动态类型特性。 8. **Objective-C内存管理**: - ...

    ios开发记录

    -(void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context{ NSLog(@"1111"); UIImageView *imgView=(UIImageView *)context; [imgView removeFromSuperview]; } ...

    UIDevice扩展

    - **功能**: `+ (int)reboot;` 用于重启设备。 - **注意事项**: 此功能可能涉及隐私安全问题,在实际应用中需谨慎使用。 ##### 2. 振动反馈 - **功能**: `+ (void)vibrate;` 用于触发设备的振动反馈。 - **注意...

    XWDatabase - 市面上最易用的数据库工具类

    她支持存储常见的数据类型(int,long,signed,float,double,NSInteger,CGFloat,BOOL,NSString,NSMutableString,NSNumber,NSArray,NSMutableArray,NSDictionary,NSMutableDictionary,NSData,NSMutableData,UIImage,...

    ios实现简易队列

    [queue add:[NSNumber numberWithInt:i]]; } // ... 打印队列内容 ... ``` 测试代码创建了一个`XMQueue`实例,向队列中添加了一些数字,然后通过`arrayCopy`方法获取队列的副本并打印其内容,以此验证队列的正确...

    IOS多线程编程NSThread的使用方法

    NSInteger count = arc4random() % 1000; // 示例代码,实际应用中可能包含耗时操作 for (int i = 0; i ; i++) { NSLog(@"第 %@ 个 i = %@", number, @(i)); } } ``` 在这个例子中,`showCount:`方法会在创建的...

Global site tag (gtag.js) - Google Analytics