其他分享
首页 > 其他分享> > iOS基础面试题汇总

iOS基础面试题汇总

作者:互联网

目录

1. #import 跟#include、@class有什么区别?#import<> 跟 #import""又什么区别?

2. 属性readwrite,readonly,assign,retain,copy,nonatomic 各是什么作用,在那种情况下用?

3. 写一个setter方法用于完成@property(nonatomic,retain)NSString *name,写一个setter方法用于完成@property(nonatomic,copy)NSString *name.

4. 对于语句NSString*obj = [[NSData alloc] init]; ,编译时和运行时obj分别是什么类型?

5. 常见的object-c的数据类型有那些, 和C的基本数据类型有什么区别?

6. id 声明的变量有什么特性?

7. Objective-C如何对内存管理的,说说你的看法和解决方法?

8. 内存管理的几条原则时什么?按照默认法则,哪些方法生成的对象需要手动释放?在和property结合的时候怎样有效的避免内存泄露?

9. 看下面的程序,三次NSLog会输出什么?为什么?

10. OC中创建线程的方法是什么?如果指定在主线程中执行代码?如何延时执行代码?

11. Difference between shallow copy and deep copy?

补充

  • 如何使用copy功能
    • 一个对象可以调用copy或mutableCopy方法来创建一个副本对象
    • copy : 创建的是不可变副本(如NSString、NSArray、NSDictionary)
    • mutableCopy :创建的是可变副本(如NSMutableString、NSMutableArray、NSMutableDictionary)
  • 使用copy功能的前提
    • copy : 需要遵守NSCopying协议,实现copyWithZone:方法
@protocol NSCopying
- (id)copyWithZone:(NSZone *)zone;
@end
  • 使用mutableCopy的前提
    • 需要遵守NSMutableCopying协议,实现mutableCopyWithZone:方法
@protocol NSMutableCopying
- (id)mutableCopyWithZone:(NSZone *)zone;
@end

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

13. Difference between categories and extensions?


14. Difference between protocol in Objective-C and interfaces in Java?


15. What are KVO and KVC?

16. What is purpose of delegates?


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


18. When we call Objective-C is runtime language what does it mean?


19. What is difference between NSNotification and Protocol?


20. What is push notification?


21. What is Polymorphism?


22. What is Singleton?


23. What is Responder Chain?



 响应者链:

24. Difference between frame and bounds?


25. Difference between method and selector?


26. Is there any garbage collection mechanism in Objective-C?

27. What is NSOperation queue?


28. What is lazy loading?


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

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



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

32. Give us example of what are delegate methods and what are data source methods of UITableview.

33. How many autoreleasepool you can create in your application? Is there any limit?

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

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

36. When retain count increase?

37. What are commonly used NSObject class methods?

38. What is convenience constructor?

39. How to design universal application in Xcode?

40. What is keyword atomic in Objective-C?

41. What are UIView animations?

42. How can you store data in iPhone applications?

43. What is NSManagedObject model?

44. What is predicate?

45. Objective-C有多继承吗?没有的话用什么代替?


46. Objective-C有私有方法吗?私有变量呢?


47. 关键字const什么含义?

48. static的作用?

49. 线程和进程的区别?

50. 堆和栈的区别?


51. 为什么很多内置的类,如TableView的delegate的属性是assign不是retain?


52. 定义属性时,什么情况使用copy、assign、retain?


53. 对象是什么时候被释放的?


54. tableView的重用机制?


55. ViewController 的loadView、viewDidLoad、viewDidUnload分别是什么时候调用的,在自定义ViewCointroller时在这几个函数中应该做什么工作?

56. ViewController的didReceiveMemoryWarning是在什么时候调用的?默认的操作是什么?


57. 怎么理解MVC,在Cocoa中MVC是怎么实现的?


58. self.跟self->什么区别?


59. id、nil代表什么?

60. 如何对iOS设备进行性能测试?

标签:面试题,sourceString,对象,iOS,汇总,What,retain,copy,方法
来源: https://www.cnblogs.com/chao8888/p/11309936.html