概述
1.简述OC中内存管理机制。与retain配对使用的方法是dealloc还是release,为什么?需要与alloc配对使用的方法是dealloc还是release,为什么?readwrite,readonly,assign,retain,copy,nonatomic,atomic,strong,weak属性的作用?
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; white-space: pre;"> </span>同步的话指的是多线程同时操作一个数据 这个时候需要对数据添加保护 这个保护就是线程的同步。</span>
<span style="word-wrap: normal; word-break: normal; line-height: 21px;"><span style="word-wrap: normal; word-break: normal; white-space: pre;"> </span><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">用GCD中的串行队列来解释多线程的同步,也就是队列中的任务为串行,它们各自对相邻的任务有依赖性,如果任务1不完成,那么任务2就不会开始,这就是同步</span></span>
<span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">6.假设有一个字符串aabcad,请写一段程序,去掉字符串中不相邻的重复字符串,既上述字符串处理之后的输出结果为:aabcd</span><span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span>
<span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span><span style="word-wrap: normal; word-break: normal; line-height: 27px; color: rgb(51, 51, 51); font-size: 18px;">答:</span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;">NSMutableString</span> *str = [[<span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;">NSMutableString</span> <span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;">alloc</span>]<span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;">initWithFormat</span>:@"aabcad"]; </span> <span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;">NSMutableArray *marry = [[NSMutableArray alloc]init];</span>
for (int i = marry.count - 1; i > 0; i--) {
<span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">7.获取一台设备唯一标示的方法有哪些?</span><span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span>
<span style="font-family:arial, courier new, courier, 宋体, monospace;color:#333333;word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 24px;"> </span></span><span style="word-wrap: normal; word-break: normal; line-height: 24px; color: rgb(51, 51, 51); font-family: arial, 'courier new', courier, 宋体, monospace; font-size: 18px; white-space: normal;">答:</span><span style="word-wrap: normal; word-break: normal; line-height: 24px; color: rgb(51, 51, 51); font-family: arial, 'courier new', courier, 宋体, monospace; white-space: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">1.UDID</span></span>
<span style="font-family:arial, courier new, courier, 宋体, monospace;color:#333333;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: 24px;"> 2.UUID</span></span>
<span style="font-family:arial, courier new, courier, 宋体, monospace;color:#333333;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: 24px;"> 3.MAC ADDRESS <wbr></wbr></span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"> 4.OPEN UDID<span style="word-wrap: normal; word-break: normal; white-space: pre;"> </span> <span style="word-wrap: normal; word-break: normal;"> 5.广告标识符<span style="word-wrap: normal; word-break: normal; white-space: pre;"> </span></span><span style="word-wrap: normal; word-break: normal; white-space: pre;"> </span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"> 6.Vindor标示符</span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">ios7之后用的时keychain(钥匙串)</span>
<span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">8.ios类是否可以多继承?如果没有,那可以用其他方法实现吗?简述实现过程。</span><span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">答:没有 用catogory、extension来实现 实现过程我会在ios复习中提到</span>
<span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">9.堆和栈的区别?</span><span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">答:堆需要用户手动释放内存,而栈则是编译器自动释放内存</span>
<span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">10.ios本地数据存储都有哪几种方式?</span><span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">答:</span><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: 26px; font-family: Tahoma, Arial, Helvetica, sans-serif, simsun;">1. <wbr>NSKeyedArchiver(加密形式)</wbr></span><span style="word-wrap: normal; word-break: normal; line-height: 26px; font-family: Tahoma, Arial, Helvetica, sans-serif, simsun;"> <wbr></wbr></span><span style="word-wrap: normal; word-break: normal; line-height: 26px; font-family: Tahoma, Arial, Helvetica, sans-serif, simsun;"> <wbr> <wbr> <wbr></wbr></wbr></wbr></span></span>
<span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">11.写出方法获取ios内存使用情况。</span><span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">答:</span>
<span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">12.深拷贝和浅拷贝的理解?</span><span style="color:#333333;word-wrap: normal; word-break: normal; line-height: 21px;"> </span>
<span style="font-family:arial, courier new, courier, 宋体, monospace;word-wrap: normal; word-break: normal;"> </span><span style="word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-family: arial, 'courier new', courier, 宋体, monospace; font-size: 20px;">答:对一个实例进行深拷贝时当前类需要实现NSCopying协议。</span></span>
<span style="word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-family: arial, 'courier new', courier, 宋体, monospace; font-size: 20px;"> 浅拷贝是复制出来一个跟原对象是同一地址的对象,而深拷贝则是复制出来一个跟源对象不同地址的对象,改变原对象,对新对象没有影响。</span></span>
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">13.怎样实现一个singleton的类。</span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">答:单例 在复习中也有提到</span></span>
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">14.什么是安全释放?</span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">答:把对象指针置为nil,再对其释放。</span></span>
<span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">15.RunLoop是什么?</span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">答:</span></span>
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">16.什么是序列化和反序列化,可以用来做什么?如何在OC中实现复杂对象的存储?</span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">答:</span></span><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: 20px; font-family: arial;">把对象转换为字节序列的过程称为对象的</span><span style="word-wrap: normal; word-break: normal; line-height: 20px; color: rgb(204, 0, 0); font-family: arial;">序列化</span><span style="word-wrap: normal; word-break: normal; line-height: 20px; font-family: arial;"> <wbr></wbr></span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: 20px; font-family: arial;"> 把字节序列恢复为对象的过程称为对象的</span><span style="word-wrap: normal; word-break: normal; line-height: 20px; color: rgb(204, 0, 0); font-family: arial;">反序列化</span></span>
<span style="word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; white-space: pre;"> </span><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">将对象写到文件或者数据库里,并且可以读取出来</span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"> 遵循NSCoding协议,来实现复杂对象的存储</span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"> 实现该协议后就可以对其进行打包或者解包,然后转化为NSData</span>
<span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-family: arial, 'courier new', courier, 宋体, monospace; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">17.写一个标准宏MIN,这个宏输入两个参数并返回较小的一个?</span></span><span style="font-family:arial, courier new, courier, 宋体, monospace;color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">答:#define MIN((A),(B)) ((A<strong>(A:B))</strong></span> </span>
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 20px;"><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px;">延展问题:写宏的时候要注意些什么问题呢?</span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 20px;">函数宏后面的参数都要用括号单独括起来,函数名大写</span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 20px;">#define A 20</span>
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">18.iphone os 有没有垃圾回收机制?简单阐述一下OC内存管理。</span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="font-family:arial, courier new, courier, 宋体, monospace;word-wrap: normal; word-break: normal;"> </span><span style="word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-family: arial, 'courier new', courier, 宋体, monospace; font-size: 20px;">答:</span><span style="font-family:arial, courier new, courier, 宋体, monospace;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;">没有垃圾回收 内存管理同1题</span></span>
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">19.简述应用程序按Home键进入后台时的生命周期,以及从后台回到前台时的生命周期?</span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="font-family:arial, courier new, courier, 宋体, monospace;word-wrap: normal; word-break: normal;"> </span><span style="word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-family: arial, 'courier new', courier, 宋体, monospace; font-size: 20px;">答:前者进行的方法有</span></span>
<span style="word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 27px; color: rgb(51, 51, 51); font-family: arial, 'courier new', courier, 宋体, monospace; font-size: 20px;"> </span><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-family: arial, 'courier new', courier, 宋体, monospace;"><span style="word-wrap: normal; word-break: normal; font-size: 18px;"> </span></span></span><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;">- (</span>void<span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;">)applicationWillResignAct<wbr>ive:(</wbr></span>UIApplication<span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;"> *)application</span></span>
<span style="word-wrap: normal; word-break: normal; color: rgb(51, 51, 51); white-space: pre;"> </span><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei; white-space: normal;">- (</span><span style="word-wrap: normal; word-break: normal; white-space: normal;">void</span><span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei; white-space: normal;">)applicationDidEnterBackg<wbr>round:(</wbr></span><span style="word-wrap: normal; word-break: normal; white-space: normal;">UIApplication</span><span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei; white-space: normal;"> *)application</span></span>
<span style="word-wrap: normal; word-break: normal; white-space: pre;"><span style="font-family:SimHei;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: normal; white-space: normal;"> <wbr> <wbr> <wbr> 后者进行的方法有</wbr></wbr></wbr></span></span></span>
<span style="word-wrap: normal; word-break: normal; white-space: pre;"><span style="font-family:SimHei;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; white-space: normal;"><span style="word-wrap: normal; word-break: normal; line-height: normal;"> <wbr> <wbr> <wbr> <wbr></wbr></wbr></wbr></wbr></span></span></span></span><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;">- (</span>void<span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;">)applicationWillEnterFore<wbr>ground:(</wbr></span>UIApplication<span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;"> *)application</span></span>
<span style="word-wrap: normal; word-break: normal; white-space: pre;"><span style="font-family:SimHei;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; white-space: normal;"><span style="font-family:SimHei;word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: normal;"> <wbr> <wbr> <wbr></wbr></wbr></wbr></span></span></span></span></span><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;">- (</span>void<span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;">)applicationWillResignAct<wbr>ive:(</wbr></span>UIApplication<span style="word-wrap: normal; word-break: normal; line-height: normal; font-family: simHei;"> *)application</span></span><span style="word-wrap: normal; word-break: normal; white-space: pre;"><span style="font-family:SimHei;word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; white-space: normal;"><span style="font-family:SimHei;word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: normal;"> </span></span></span></span></span><span style="color:#333333;word-wrap: normal; word-break: normal; font-family: arial, 'courier new', courier, 宋体, monospace; white-space: pre-wrap;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-family: arial, 'courier new', courier, 宋体, monospace; white-space: pre-wrap; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">20.ViewController 的 alloc,loadView,ViewDidLoad,ViewWillAppear,ViewDidUnload,dealloc,init分别是在什么时候调用的?在自定义ViewController的时候这几个函数里面应该做什么工作?</span></span><span style="color:#333333;word-wrap: normal; word-break: normal; font-family: arial, 'courier new', courier, 宋体, monospace; white-space: pre-wrap;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">答:alloc申请内存时调用</span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;"> loadView加载视图时调用</span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;"> ViewDidLoad视图已经加载后调用</span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;"> ViewWillAppear视图将要出现时调用</span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;"> ViewDidUnload视图已经加载但没有加载出来调用</span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;"> dealloc销毁该视图时调用</span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;"> init视图初始化时候调用<span style="word-wrap: normal; word-break: normal; line-height: 30px; white-space: pre;"> </span></span></span>
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">21.描述应用程序的启动顺序。</span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">答:</span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: 18px; font-family: Verdana, Arial, Helvetica, sans-serif;">1. 程序入口main函数创建UIApplication实例和UIApplication代理实例。</span> </span>
2. 在UIApplication代理实例中重写启动方法,设置根ViewController。
3. 在第一ViewController中添加控件,实现应用程序界面。
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">22.为什么很多内置类如UITableViewControl的delegate属性都是assign而不是retain?请举例说明。</span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 20px;">答:</span></span>
<span style="word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 20px;">避免循环引用 </span></span>
<span style="word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 20px;">比如:对象A创建并引用到了对象B,对象B创建并引用到了对象C,对象C创建并引用到了对象B,这个时候B的引用计数是2,而C的引用计数是1,当A不用B的时候,就释放了B的所有权,这个时候C还引用对象B,所有B不会释放,引用计数为1;因为B也引用着对象C,B不释放,那么C就不会被释放,所有它们的引用计数都为1,并且永远不会被释放,所以形成了循环引用。</span></span>
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">23.使用UITableView时候必须要实现的几种方法?</span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">答:</span></span>
<span style="word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;">- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;</span><br style="margin: 0px; line-height: normal; font-family: simHei;" /> <span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;">- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)i</span><span style="word-wrap: normal; word-break: normal; line-height: 36px; color: rgb(255, 255, 255); font-size: 24px;">ndexPath;</span></span>
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">24.写一个便利构造器。</span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">答:</span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">- (id)studentWithName:(NSString *)name andAge:(NSInter)age{</span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"> MyView *view = [[MyView alloc]initWithName:name andAge:age];</span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"> return [view autorelease];</span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">}</span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">25.UIImage初始化一张图片有几种方法?简述各自的优缺点。</span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 20px;">答:</span></span>
<span style="word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 20px;">3种</span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: 28px; color: rgb(0, 0, 0); font-family: arial, 宋体, sans-serif; white-space: normal;">imageNamed:系统会先检查系统缓存中是否有该名字的Image,如果有的话,则直接返回,如果没有,则先加载图像到缓存,然后再返回。</span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;"><span style="word-wrap: normal; word-break: normal; line-height: 28px; color: rgb(0, 0, 0); font-family: arial, 宋体, sans-serif; white-space: normal;">initWithContentsOfFile:系统不会检查系统缓存,而直接从文件系统中加载并返回。</span></span>
<span style="word-wrap: normal; word-break: normal; line-height: 28px; color: rgb(0, 0, 0); font-family: arial, 宋体, sans-serif; white-space: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 27px; font-size: 18px;">imageWithCGImage:scale:orientation 当scale=1的时候图像为原始大小,orientation制定绘制图像的方向。</span></span><span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;"> </span></span>
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">1.回答person的retainCount值,并解释为什么?</span></span> </span>
<span style="color:#FF0000;word-wrap: normal; word-break: normal;"> <span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">Person *per = [[Person alloc]init];</span></span> </span>
<span style="color:#FF0000;word-wrap: normal; word-break: normal;"> <span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">self.person = per;</span></span></span><span style="color:#333333;word-wrap: normal; word-break: normal;"> </span>
<span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">答:1或者2,alloc+1,assign+0,retain+1</span></span>
<span style="color:#333333;word-wrap: normal; word-break: normal;"> </span><span style="color:#FF0000;word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">2.这段代码有什么问题吗?</span></span>
<span style="color:#FF0000;word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">@implementation Person</span></span></span>
<span style="color:#FF0000;word-wrap: normal; word-break: normal;"><span style="word-wrap: normal; word-break: normal; line-height: 30px; font-size: 20px;"><span style="word-wrap: normal; word-break: normal; line-height: 27px;">-(void)setAge:(int)newAge{self.age = newAge;}</span></span> </span>
NSMutableArray *array = [[NSMutableArray alloc]init];//本地敏感字库
int sl(const char *s)
{
}
最后
以上就是舒适哑铃为你收集整理的iOS 面试题(一)的全部内容,希望文章能够帮你解决iOS 面试题(一)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复