1.Difference between shallow copy and deep copy?

浅复制 只拷贝地址 不拷贝地址指向的对象

深复制 拷贝地址 并且指向拷贝的新对象

2.What is advantage of categories? What is difference between implementing a category and inheritance?

categories: 在不影响或修改原来的类别或模组的情况下去修改原有的功能,增加新的功能

3.Difference between categories and extensions?

categories: 在不影响或修改原来的类别或模组的情况下去修改原有的功能,增加新的功能

4.Difference between protocol in objective c and interfaces in java?

暂时觉得它们是一样的 protocol 可以被继承 interfaces 不可以

在java 中的interfaces 在 objective-c 中就是 protocol

在java 中的 class 在 objective-c 中就是 interface

5.What are KVO and KVC?

转自 http://magicalboy.com/kvc_and_kvo/

一个对象拥有某些属性。比如说,一个 Person 对象有一个 name 和一个 address 属性。以 KVC 说法,Person 对象分别有一个 value 对应他的 name 和 address 的 key。 key 只是一个字符串,它对应的值可以是任意类型的对象。从最基础的层次上看,KVC 有两个方法:一个是设置 key 的值,另一个是获取 key 的值。如下面的例子:

  1. void changeName(Person *p, NSString *newName)
  2. {
  3. // using the KVC accessor (getter) method
  4. NSString *originalName = [p valueForKey:@"name"];
  5. // using the KVC  accessor (setter) method.
  6. [p setValue:newName forKey:@"name"];
  7. NSLog(@"Changed %@'s name to: %@", originalName, newName);
  8. }

现在,如果 Person 有另外一个 key 配偶(spouse),spouse 的 key 值是另一个 Person 对象,用 KVC 可以这样写:

  1. void logMarriage(Person *p)
  2. {
  3. // just using the accessor again, same as example above
  4. NSString *personsName = [p valueForKey:@"name"];
  5. // this line is different, because it is using
  6. // a "key path" instead of a normal "key"
  7. NSString *spousesName = [p valueForKeyPath:@"spouse.name"];
  8. NSLog(@"%@ is happily married to %@", personsName, spousesName);
  9. }

Key-Value Observing (KVO) 建立在 KVC 之上,它能够观察一个对象的 KVC key path 值的变化。举个例子,用代码观察一个 person 对象的 address 变化,以下是实现的三个方法:

  • watchPersonForChangeOfAddress: 实现观察
  • observeValueForKeyPath:ofObject:change:context: 在被观察的 key path 的值变化时调用。
  • dealloc 停止观察static NSString *const KVO_CONTEXT_ADDRESS_CHANGED = @"KVO_CONTEXT_ADDRESS_CHANGED"
    1. @implementation PersonWatcher
    2. -(void) watchPersonForChangeOfAddress:(Person *)p
    3. {
    4. // this begins the observing
    5. [p addObserver:self
    6. forKeyPath:@"address"
    7. options:0
    8. context:KVO_CONTEXT_ADDRESS_CHANGED];
    9. // keep a record of all the people being observed,
    10. // because we need to stop observing them in dealloc
    11. [m_observedPeople addObject:p];
    12. }
    13. // whenever an observed key path changes, this method will be called
    14. - (void)observeValueForKeyPath:(NSString *)keyPath
    15. ofObject:(id)object
    16. change:(NSDictionary *)change
    17. context:(void *)context
    18. {
    19. // use the context to make sure this is a change in the address,
    20. // because we may also be observing other things
    21. if(context == KVO_CONTEXT_ADDRESS_CHANGED) {
    22. NSString *name = [object valueForKey:@"name"];
    23. NSString *address = [object valueForKey:@"address"];
    24. NSLog(@"%@ has a new address: %@", name, address);
    25. }
    26. }
    27. -(void) dealloc;
    28. {
    29. // must stop observing everything before this object is
    30. // deallocated, otherwise it will cause crashes
    31. for(Person *p in m_observedPeople){
    32. [p removeObserver:self forKeyPath:@"address"];
    33. }
    34. [m_observedPeople release];
    35. m_observedPeople = nil;
    36. [super dealloc];
    37. }
    38. -(id) init;
    39. {
    40. if(self = [super init]){
    41. m_observedPeople = [NSMutableArray new];
    42. }
    43. return self;
    44. }
    45. @end

    这就是 KVO 的作用,它通过 key path 观察对象的值,当值发生变化的时候会收到通知。

6.What is purpose of delegates?

7.What are mutable and immutable types in Objective C?

8.When we call objective c is runtime language what does it mean?

9.what is difference between NSNotification and protocol?

10.What is push notification?

11.Polymorphism?

12.Singleton?

单例

13.What is responder chain?

14.Difference between frame and bounds?

15.Difference between method and selector?

16.Is there any garbage collection mechanism in Objective C.?

17.NSOperation queue?

18.What is lazy loading?

19.Can we use two tableview controllers on one viewcontroller?

20.Can we use one tableview with two different datasources? How you will achieve this?

21.What is advantage of using RESTful webservices?

22.When to use NSMutableArray and when to use NSArray?

23.What is the difference between REST and SOAP?

24.Give us example of what are delegate methods and what are data source methods of uitableview.

25.How many autorelease you can create in your application? Is there any limit?

26.If we don’t create any autorelease pool in our application then is there any autorelease pool already provided to us?

27.When you will create an autorelease pool in your application?

28.When retain count increase?

29.Difference between copy and assign in objective c?

30.What are commonly used NSObject class methods?

31.What is convenience constructor?

32.How to design universal application in Xcode?

33.What is keyword atomic in Objective C?

34.What are UIView animations?

35.How can you store data in iPhone applications?

36.What is coredata?

37.What is NSManagedObject model?

38.What is NSManagedobjectContext?

39.What is predicate?

40.What kind of persistence store we can use with coredata?

ios技术面试题的更多相关文章

  1. 收集了一些iOS技术面试题

    1.Difference between shallow copy and deep copy?
浅复制和深复制的区别? 
答案:浅层复制:只复制指向对象的指针,而不复制引用对象本身.
深层复制:复制 ...

  2. 最全的iOS面试题及答案-转载

    1. Object-c的类可以多重继承么?可以实现多个接口么?Category是什么?重写一个类的方式用继承好还是分类好?为什么? 答: Object-c的类不可以多重继承:可以实现多个接口,通过实现 ...

  3. IOS面试题总结

    iOS面试题: 一:网络理论知识的理解 1:Internet物理地址和IP地址转换采用什么协议 ARP(Address Resolution Protocol)地址解析协议 2:Internet采用哪 ...

  4. iOS面试题及答案2015.6.7

    iOS面试题及答案     1. Object-c的类可以多重继承么?可以实现多个接口么?Category是什么?重写一个类的方式用继承好还是分类好?为什么? 答: Object-c的类不可以多重继承 ...

  5. iOS 面试题 总结

    #include <iostream> using namespace std; int main () { char p[]={'a','b','c'}, q[]="abc&q ...

  6. [转载]iOS面试题总

    转载自:http://blog.sina.com.cn/s/blog_67eb608b0101r6xb.html (2014-06-13 20:23:33) 转载▼ 标签: 转载   crash 原文 ...

  7. 试答卓同学的 iOS 面试题

    卓同学昨天写了一篇文章<4道过滤菜鸟的iOS面试题>.我手痒决定默写一个参考答案.后来发现不认真回答被大家喷成狗,所以决定积极改造,重新做人.下面就是修编之后的答案. 1. struct和 ...

  8. iOS面试题大全-点亮你iOS技能树

    所有的内容大部分来自于网络的搜集,所以我不是一个创造者,而是一个搬运工.我尽量把题目,尤其是参考答案的出处列明.若有任何疑问,建议,意见,请联系我. 第一部分面试题来源于iOS-Developer-I ...

  9. 原 iOS面试题收集

    原 iOS面试题收集 发表于2年前(2013-07-22 13:47)   阅读(369) | 评论(0) 4人收藏此文章, 我要收藏 赞0 听云性能监测产品App.Server.CDN免费试用,绑定 ...

随机推荐

  1. 【java.math.BigInteger】常用函数

    1. /* 返回此BigInteger的函数正负号. 此方法返回-1,0或1作为此BigInteger的值对应是负,零或正数. */ java.math.BigInteger.signum(BigIn ...

  2. 前端工作流程自动化——Grunt/Gulp 自动化

    什么是自动化 先来说说为什么要自动化.凡是要考虑到自动化时,你所做的工作必然是存在很多重复乏味的劳作,很有必要通过程序来完成这些任务.这样一来就可以解放生产力,将更多的精力和时间投入到更多有意义的事情 ...

  3. Flex前台和后台WCF服务之间数据的接收与传输

    1.首先在flex程序中通过添加webservice,方式是主菜单Data->Connect to WebService,然后输入wsdl文档的地址.如果输入地址后始终添加不进了,或者报错,一般 ...

  4. php学习笔记4--php中的变量作用域

    变量作用域:可以简单地理解为变量的可见区域,变量能被访问的范围.如同其他语言,php中也有全局作用域和局部作用域之分,但是不同的是:php中的全局作用域指的是:只能在函数外部使用,而局部作用域指的是: ...

  5. php面向对象的基础:创建OOP的类和字段

    类的创建 class Computer{ //类的字段(成员) //类的方法 } 对象的声明 $computer = new Computer(); new标识符是为了在内存中创建一个对象(实例),而 ...

  6. 【ASP.NET】获取网站目录的方法

         获取网站物理路径: HttpRuntime.AppDomainAppPath 获取网站虚拟路径: HttpRuntime.AppDomainAppVirtualPath

  7. 20140213-想念是while里的死循环

    // stdafx.h : 标准系统包含文件的包含文件,// 或是经常使用但不常更改的// 特定于项目的包含文件// #pragma once#include "targetver.h&qu ...

  8. html5定位并在百度地图上显示

    在开发移动端 web 或者webapp时,使用百度地图 API 的过程中,经常需要通过手机定位获取当前位置并在地图上居中显示出来,这就需要用到html5的地理定位功能. navigator.geolo ...

  9. Nginx +keepalived

    Nginx +keepalived   配置高可用的Nginx 准备环境: 节点node17,node18   lftp 172.16.0.1:/pub/Sources/6.x86_64/nginx ...

  10. 如何设置fedora默认从命令行启动?

    Sumary:因为在fedora中没有/etc/initab文件我们不方便从这里设置它的runlevel target,但是linux又给我们提供了一个强悍的工具systemd,我们可以用system ...