IOS Face Questions

Source: Internet
Author: User

1. What are the differences and usages of nsnotification and KVO? When should I use a notification, when should I use KVO, and what is the difference in implementation? Is it possible to use delegate and protocol to achieve similar functionality? What are the potential problems if possible? If not, why not? KVO can only monitor the property changes, but the implementation of automatic monitoring, when the value of the property changes, will automatically notify the Observer Nsnotification more flexible, can monitor more content, but need to be the observer manually send a notification, the observer can respond. Protocol by adding a nsarray can also achieve similar functions, but the implementation of the need to handle the delegate of the addition and deletion, their own changes in the property of manual notification, more cumbersome, error-prone. 2the. Main file Uiapplicationmain has several parameters that act as Uiapplicationmain it accepts 4 parameters. The two parameters of argc and argv are from two parameters accepted by main (), and the other two string parameters represent the main class of the program (Principalclass) and the proxy class (Delegate class)。 If the main class (Principalclass) is nil, the default is UIApplication Uiapplicationmain creates UIApplication objects based on Principalclassname. Then create a delegate object based on Delegateclassname3When do I use Nsmutablearray and when do I use Nsarray? When the array is running in the program, it needs to be constantly changing, using the Nsmutablearray, when the array is initialized, it will no longer change, use Nsarray. It should be noted that the use of Nsarray only indicates that the array does not change at run time, i.e. it cannot add and remove elements to the Nsaarry array, but does not indicate that the contents of elements within its array cannot be changed. Nsarray is thread-safe, Nsmutablearray is not thread-safe, and multithreading is used to nsmutablearray needs attention. 4. What's the difference between nil and nil? Nil means a objctive-c object, pointer to null for this object. Nil defines a class (which is class, not an object) that points to an empty5.  A simple understanding of the understanding of MVC: V is not able to communicate with M. C to M communication: API m to c communication: Notification,kvo C to v communication: Outlet V to C communication: Target-Action, Delegate,datasource5. What is the difference between Nsinteger and int#if__lp64__ | | Ns_build_32_like_64typedefLongnsinteger;typedef unsignedLongNsuinteger;#elsetypedefintnsinteger;typedef unsignedintNsuinteger;#endif6.IDWhat are the characteristics of declared objects? An Id-declared object has a runtime attribute that can point to any type of objcetive-the object of C;7. objective-c The way memory is managed. You know a few objective .-the memory management of C mainly has three ways arc, manual memory count, auto free pool (autoreleasepool)8How to test the performance of your app Porfile-Activity Monitor9how to detect app memory leaks Porfile-LeaksTen. How to filter arrays//Data SourceNsarray *dataarr = [Nsarray arraywithobjects:@"A1",@"ABC1",@"ABC4",@"ABC2", nil];//Filter ObjectsNsarray *filterarr = [Nsarray arraywithobjects:@"ABC1",@"ABC2", nil];//Filter FiltersNspredicate *thepredicate = [Nspredicate predicatewithformat:@"Not (self in %@)", Filterarr];//New Filtered ArrayNsarray *resultarr =[[Nsarray Alloc]initwitharray:[dataarr filteredarrayusingpredicate:thepredicate]]; NSLog (@"filtered results:%@", Resultarr); One. UITableView inherit that class? Uiscrollview inherit that class? UIView inherit that class? UITableView inheritance Uiscrollviewuiscrollview inheritance Uiviewuiview inheritance Uiresponder A. The relationship between UIView and UIWINDW? The role of UIWindow UIWindow inherits UIView. Function:1. UIWindow as a container, put all the UIView2Distribute the event (for example: Click events, drag events, and so on) to the view.  -What is the difference between shallow copy and deep copy? Shallow copy: Copies only pointers to objects, not the reference object itself. Deep copy: Copies the reference object itself.  the. What is the responder chain?The event is referred to the first responder object, and if the first responder is not processed, the event is passed up along the responder chain and handed over to the next responder. In general, the first responder is a view or control, and the event responds first, and if the first responder does not handle the event, the event is passed to its view controller, and if the view controller does not handle the event, the event is passed to the parent view, and if the parent view does not respond, the event goes to the parent view controller. And so on until the top-level view. The next step is to move along the top-level view to the window (UIWindow object) to the program (UIApplication object). If the uiapplication does not respond to the event, the event gradually goes to sleep. 

IOS Face Questions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.