19. iOS face test and self-organizing · Three

Source: Internet
Author: User

1. Please describe your understanding of the factory method.

Factory mycontrol, design controls are used in factory design mode. A class cluster is similar to a factory design pattern; A factory pattern is a definition of an interface that creates objects, so that subclasses decide which class to instantiate. Thus, the instantiation of the class is deferred to the subclass

2 . What are the optimization methods for UITableView?

The optimization of UITableView is mainly from three aspects:

? calculate and cache a good height (layout) in advance, because Heightforrowatindexpath: is the most frequent method of invocation;

? The asynchronous drawing, encounters the complex interface, encounters the performance bottleneck, may be the breach;

? load on demand when sliding, this is very useful when a large number of pictures are displayed and the network is loaded! (Sdwebimage has implemented asynchronous loading, with this performance leverage).

3. How do you understandblock, What is the purpose of block?

? We can think of Block as an anonymous function of objective-c. Block allows developers to pass arbitrary statements as data between two objects, often more intuitively than referencing functions defined elsewhere. In addition, the implementation of block is closed (closure), but it is easy to get the relevant state information of the context.

? Block is a block of code that is similar in nature to variables. The difference is that the code block stores the data as a function body. With Block, you can pass in parameters like any other standard function and get the return value.

As a property of the OC object, implement the pass-through value between objects ? a Block can be considered a variable, so it can be used as a property of an OC object

4. How can I ensure that the location is more power-saving?

1. After starting the positioning, do not close, let it continue to position

2. Set the distance filter : coordinates are moved to a specified distance before the proxy method is invoked

3. set the accuracy: By reducing the calculation process (GPS), to achieve the purpose of power saving

5. Please outline the use of nsuserdefaults and precautions for use ?

Suserdefaults is ideal for storing lightweight data, not only to store basic data types, but also to store nsnumber(Integer,Float, Double),nsstring,nsdate,nsarray,nsdictionary,BOOL type.

however , Nsuserdefaults cannot store custom class objects, and if an object is stored in nsuserdefaults, an error will be made. Smart people put objects in an array, and then put the array into nsuserdefaults, but doing things wrong, because the array contains custom objects.

To deposit a custom object in Nsuserdefaults, the object needs to follow the nscoding protocol and implement the Encodewithcoder method and Initwithcoder method. Specific reference Http://my.oschina. NET/u/1245365/blog/294449

It is worth mentioning that I found that the type of NSNull empty data is also unable to deposit nsuserdefaults . If the data has a NSNull type of empty data, put it nil can be deposited nsuserdefaults.

In summary,Nsuserdefaults is a simple database operation.

6. What technology does the database use for IOS ?

Use Sqlite and coredata implementations of

7. How do I store the data model in IOS ?

archiving is also a way for IOS to store data for developers, and virtually all data types can be accessed through archiving. Its storage and reading process, mainly packaged in two classes:nskeyedarchiver and nskeyedunarchiver

19. iOS face test and self-organizing · Three

Related Article

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.