Basic Questions for iOS (part 3)

Source: Internet
Author: User

There are 20 questions for iOS in the previous article, which is the second half.

IOS interview series:

IOS interview

IOS interview questions (1)

IOS interview question (2)

IOS interview questions (4)

1. When to use nsmutablearray and when to use nsarray?

When Will nsmutablearray and nsarray be used?

Answer: When the array is running, it needs to change constantly. When nsmutablearray is used, the array will not be changed after initialization. nsarray is used. It should be pointed out that nsarray only indicates that the array does not change during runtime, that is, it cannot add or delete elements to the array of nsarry, but it does not indicate that the content of the elements in the array cannot be changed. Nsarray is thread-safe, and nsmutablearray is NOT thread-safe. Pay attention to the use of nsmutablearray in multiple threads.

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

An instance of the delegate method is provided, and the data source method of uitableview is presented.

Answer: a large number of delegates are used in the cocoatouch framework. uitableviewdelegate is a typical application of the delegation mechanism. It is a typical use of delegation to implement the adapter mode. The uitableviewdelegate protocol is the target and tableview is the adapter, implement the uitableviewdelegate protocol and set itself as the delegate object of talbeview. It is an adapter. Generally, this object is uitableviewcontroller.

The data source methods of uitableview include-(nsinteger) tableview :( uitableview *) tableview numberofrowsinsection :( nsinteger) Section;

-(Uitableviewcell *) tableview :( uitableview *) tableview cellforrowatindexpath :( nsindexpath
*) Indexpath;


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

How many autorelease objects can be created in an application? Is there a limit?

Answer: None

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

If we do not create a memory pool, is there a memory pool provided to us?

Answer: The interface thread maintains its own memory pool. If you create a data thread, you need to create a memory pool for the thread.

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

When do I need to create a memory pool in the program?

Answer: If you create a data thread, you need to create a memory pool for the thread.

6. When retain count increase?

When will the memory count increase?

Answer: see Ios interview questions (1)

7. what are commonly used nsobject class methods?

Which nsobject-like methods are frequently used?

Answer: nsobject is the base class of Objetive-C. It consists of the nsobject class and a series of protocols.

The class method alloc, class, description object method init, dealloc,-javasmselector: withobject: afterdelay: and so on are frequently used.

8. What is convenience constructor?

What is a simple constructor?

Answer: The simple construction method is generally provided by the cocoatouch framework, such as nsnumber + numberwithbool: + numberwithchar: + numberwithdouble: + numberwithfloat: + numberwithint:

Most classes under Foundation have simple constructor methods. We can use simple constructor methods to obtain the objects created by the system for us without manual release.

9. How to Design universal application in xcode?

How can I use xcode to design general applications?

Answer: Use the MVC pattern to design applications. The model layer is separated from the interface, that is, the model layer can run on any device and on the Controller layer, select different viewcontroller Objects Based on the characteristics of iPhone and iPad (unique uisplitviewcontroller. In the view layer, you can design it according to actual requirements. In the XIB file design, it is set to universal.

10. What is keyword atomic in Objective C?

When is Objetive-C atomic keyword?

Answer: Atomic. For nonatomic information, see Ios interview questions (1)

11. What are uiview animations?

What are the animation effects of uiview?

Answer: There are many such as uiviewanimationoptioncurveeaseinout.
Uiviewanimationoptioncurveeasein
Uiviewanimationoptioncurveeaseout
Uiviewanimationoptiontransitionflipfromleft
Uiviewanimationoptiontransitionflipfromright
Uiviewanimationoptiontransitioncurlupuiviewanimationoptiontransitioncurldown

How to use this blog

12. How can you store data in iPhone applications?

How to save data in iPhone applications?

Answer: There are several storage mechanisms:

1. Save it on the server through Web Services

2. The nscoder curing mechanism is used to save the object in the file.

3. Save data in the file database through SQLite or coredata

13. What is coredata?

What is coredata?

Answer: coredata is a data storage framework provided by Apple Based on SQLite.

14. What is nsmanagedobject model?

What is the nsmanagedobject model?

Answer: nsmanagedobject is a subclass of nsobject and an important component of coredata. It is a common class that provides the basic functions required by the core data model layer. Users can subtype nsmanagedobject through the subclass, create your own data model.

15. What is nsmanagedobjectcontext?

What is nsmanagedobjectcontext?

Answer: The nsmanagedobjectcontext object is responsible for interaction between applications and databases.

16. What is predicate?

What are predicates?

Answer: The predicate uses nspredicate to filter data based on given logical conditions.

Predicate = [nspredicate predicatewithformat: @ "customerid = % d", N];

A = [Customers filteredarrayusingpredicate: predicate];


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

What persistence storage mechanisms does coredata provide?

Answer: None



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.