iOS开发问题集锦
2016-04-13 12:40
399 查看
NSStringFromSelector(_cmd)
_cmd是隐藏的参数,代表当前方法的selector,他和self一样都是每个方法调用时都会传入的参数,动态运行时会提及如何传的这两个参数,
该方法一般用于log中,执行这个方法就会输出方法的名称,这样做是为了跟踪查看方法调用的前后顺序,或者想看看程序到底在那个方法内部崩溃的
int,NSInteger,NSUInteger,NSNumber之间的区别和联系
int是32位的整数,而NSInteger与设备无关,不用考虑设备是32位还是64位,推荐用NSInteger
NSUInteger是无符号的,即没有负数
NSInteger是基础类型,而NSNumber是一个类,类似于java中int与integer的关系
NSNumber * intNumber = [[NSNumber alloc] initWithInt:5];
NSNumber * floatNumber = [[NSNumber alloc] initWithFloat:3.14f];
NSNumber * doubleNumber = [[NSNumber alloc] initWithDouble:6.7];
NSNumber * charNumber = [[NSNumber alloc] initWithChar:'A'];
(http://www.cnblogs.com/GISerYang/p/3340764.html)
NSNumber应该用strong修饰,因为是不可变的(immutable),见 http://www.jianshu.com/p/26210296fa02
IOS网络开发NSURLSession http://blog.csdn.net/hello_hwc/article/details/44565115
sizeWithFont is deprecated的解决方法
sizeWithFont从iOS7开始已经废弃,官方推荐用sizeWithAttributes方法,具体的使用方式为
NSDictionary *attributes = @{NSFontAttributeName: self.titleLabel.font};CGSize badgeSize = [badgeValue sizeWithAttributes:attributes];
NSString转换为int
NSString *str = @"200";int code = [str intValue];
相关文章推荐
- iOS GCD最大并发控制
- iOS AFNetworking基本使用
- 移动开发:iOS开发者的Apple Pay编程指南
- 初识ios自动化(一)
- [正则表达式]iOS中3种正则表达式的使用与比较
- iOS开发之tableView点击下拉扩展与内嵌collectionView上传图片效果
- iOS 模态跳转与返回
- IOS开发多线程篇—GCD介绍
- ionic cordova 控制iOS状态栏的显示,隐藏,颜色
- IOS开发多线程篇—GCD介绍
- 【ios开发】教你如何建一个小的model,来接受后台传过来的字典或者数组
- iOS开发之触摸事件
- iOS资源大全
- c#后台 极光推送到Android 和IOS客户端
- iOS 真机测试提示框处理
- include<stdio.h> 和include<iostream.h>的区别
- iOS 真机测试的提示框
- ios7之后屏幕右滑返回
- iOS7以后导航栏按钮颜色问题
- iOS常用系统调用