IOS object-C interview questions

Source: Internet
Author: User

After several rounds of interviews, I will summarize the questions frequently asked during the interview:

1. What is the difference between iPad development and iPhone development?

A: The development of iPad and iPhone applications use the same SDK. The differences between these sdks are mainly reflected in the hardware and UI operations of devices. (1) device hardware: Because the iPad does not have the phone function and ipad1 does not have a camera, related features such as phone and SMS cannot be used. (2) UI operation: Because the screen size of the iPad is 9.7 inch, and the screen size of the iPhone is 3.5 inch, the two operations are different. Some controls, such as uipopovercontroller and uisliptviewcontroller, can only be used on iPad, but not on iPhone. Moreover, when presentmodalviewcontroller is required, window
Presentation style is only valid for iPad. In addition, you must consider adding a Multi-finger gesture to the iPad screen to increase the user experience.

2. What are the relationships and differences between objective-C and C ++?

A: Objective-C and C ++ are both object-oriented supersets of C.

Differences between objects and C ++: Objective-C is completely dynamic and supports dynamic type resolution (dynamic typing) and dynamic binding (dynamic binding) at runtime) and dynamic loading. c ++ is partially dynamic. It is statically bound during compilation and simulated by embedding classes (multiple inheritance) and virtual functions (Virtual tables.
Objective-C supports dynamic message forwarding at the language level. The message sending syntax is [object function], and C ++ is object-> function (). The semantics of the two is also different. In objective-C, it refers to sending a message to an object. It does not crash whether the object can respond to the message or respond to or forward the message; in C ++, an operation is performed on an object. If the object does not have this operation, an error is reported during compilation (static binding ), or the program will crash (dynamic binding ).

For more information, see: (Luo chaohui blog)

Http://www.cppblog.com/kesalin/archive/2010/12/26/compare_objective_c_and_c_plus_plus.html

3. # differences between include and # import; # differences between import and @ class.

# The import command is an improved version of # include for Object-C. # import ensures that the referenced file will only be referenced once, so that you will not fall into the recursive inclusion issue.

# The difference between import and @ class is:

  1. # Import will link all the information of this header file, including entity variables and Methods. While @ class only tells the compiler that the name declared after it is the name of the class, you do not need to consider how these classes are defined.
  2. In header files, you only need to know the name of the referenced class. You do not need to know its internal entity variables and methods. Therefore, in header files, @ class is generally used to declare this name as the class name. In the implementation class, because the internal object variables and methods of the referenced class are used, # import must be used to include the header file of the referenced class.
  3. In terms of compilation efficiency, if you have 100 header files # imported the same header file, or these files are referenced in sequence, such as a-> B, B-> C, c-> D. When the header file at the beginning changes, all the classes that reference it later need to be re-compiled. If there are many classes, this will take a lot of time. Instead, @ class is not used.
  4. If there is a circular dependency such as a-> B, B-> A, if # import is used to contain each other, a compilation error occurs, if @ class is used to declare each other in the header files of the two classes, no compilation error occurs. Therefore, in general, @ class is placed in the interface, just to reference this class in the interface and use this class as a type. In the implementation class that implements this interface, if you need to reference the object variables or methods of this class, you still need to import the classes declared in @ class.

4. Differences between loadview and viewdidload

5. A brief introduction to core data

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.