ios 面试(3 )

来源:互联网 发布:网络舆情危机 编辑:程序博客网 时间:2024/05/16 06:02

1.What is NSRunloop?

什么是NSRunloop?
 Answer:-


A run loop is an abstraction that (among other things) provides a mechanism to handle system input sources (sockets, ports, files, keyboard, mouse, timers, etc).


Each NSThread has its own run loop, which can be accessed via the currentRunLoop method.

In general, you do not need to access the run loop directly, though there are some (networking) components that may allow you to specify which run loop they will use for I/O processing.

A run loop for a given thread will wait until one or more of its input sources has some data or event, then fire the appropriate input handler(s) to process each input source that is "ready.".

After doing so, it will then return to its loop, processing input from various sources, and "sleeping" if there is no work to do.

2.If an iPhone thrown upward ,how to measure the height device travelled ?

Answer:-

Put your phone on the table. What is it’s acceleration? That’s easy, right? It has an acceleration of zero m/s2 because it is stationary and STAYING stationary. Now give it a toss (but don’t really because you could totally break your phone). What’s it’s acceleration while it’s in the air and not touching your hand? Yes, it is in free fall and has an acceleration of 9.8 m/s2 towards the ground.

Now, if you know the acceleration and  the time the object is in the air with this acceleration (since it is recorded from the phone) then you can find the height.

3.What are layer objects and what do they represent?
layer 是什么?
Answer:-


 Layer objects are data objects which represent visual content. Layer objects are used by views to render their content. Custom layer objects can also be added to the interface to implement complex animations and other types of sophisticated visual effects.

4.Apart from incorporating views and controls, what else an app can incorporate?
app 除了包含views he controls还有?
Answer:-


Apart from incorporating views and controls, an app can also incorporate Core Animation layers into its view and control hierarchies.

5.If you wish to define your custom view. Which class will be subclassed?
如果你想自定义View,你会继承什么类?
Answer:-


 Custom views can be defined by subclassing UIView.


6.Define view object.
view的定义?
Answer:-


Views along with controls are used to provide visual representation of the app content. View is an object that draws content in a designated rectangular area and it responds to events within that area.

7.How do you change the content of your app in order to change the views displayed in the corresponding window?
怎样改变app内容?
Answer:-


To change the content of your app, you use a view controller to change the views displayed in the corresponding window. Remember, window itself is never replaced.

8.What is the purpose of UIWindow object?
UIWindow作用?
Answer:-


The presentation of one or more views on a screen is coordinated by UIWindow object.协调多个view

9.Which is the super class of all view controller objects?
view controller的超类?

Answer:-

UIViewController class. The functionality for loading views, presenting them, rotating them in response to device rotations, and several other standard system behaviours are provided by UIViewController class.

10.Which object manage the presentation of app's content on the screen?
怎样管理呈现在屏幕上的app内容?
Answer:-


View controller objects takes care of the presentation of app's content on the screen. A view controller is used to manage a single view along with the collection of subviews. It makes its views visible by installing them in the app’s window.

11. Are document objects required for an application? What does they offer?
Document objects 

Answer:-

Document objects are not required but are very useful in grouping data that belongs in a single file or file package.

12.Which app specific objects store the app's content?
那个类指定objects 存储app内容
Answer:-


Data model objects are app specific objects and store app’s content. Apps can also use document objects to manage some or all of their data model objects.

13.What happens if UIApplication object does not handle an event?

Answer:-


In such case the event will be dispatched to your app delegate for processing.

14.How is the app delegate is declared by Xcode project templates?

Answer:-


App delegate is declared as a subclass of UIResponder by Xcode project templates.

15.Which object is create by UIApplicationMain function at app launch time?
UIApplicationMain 

Answer:-

The app delegate object is created by UIApplicationMain function at app launch time. The app delegate object's main job is to handle state transitions within the app.

16.What is the use of controller object UIApplication?
controller object UIApplication作用

Answer:-

Controller object UIApplication is used without subclassing to manage the application event loop.
It coordinates other high-level app behaviours. 
It works along with the app delegate object which contains app-level logic.

17.Who calls the main function of you app during the app launch cycle?
什么时候调用main 函数
Answer:-

During app launching, the system creates a main thread for the app and calls the app’s main function on that main thread. The Xcode project's default main function hands over control to the UIKit framework, which takes care of initializing the app before it is run.

18.List down app's state transitions when it gets launched.
列出launch后app状态转换
Answer:-


Before the launch of an app, it is said to be in not running state.
When an app is launched, it moves to the active or background state, after transitioning briefly through the inactive state.

19.Where can you test Apple iPhone apps if you don’t have the device?
怎样测试app?
Answer:-


iOS Simulator can be used to test mobile applications.Xcode tool that comes along with iOS SDK includes Xcode IDE as well as the iOS Simulator. Xcode also includes all required tools and frameworks for building iOS apps. However, it is strongly recommended to test the app on the real device before publishing it.

20.Difference between View and Layer?
view和layer区别
Answer:-


Layers

-Represent position, shape and anchor point
-Do not receive touch events Light-weight
-Implicit animations

Views

-Can receive touch eventsAre always backed by a Layer on iOS
-No implicit animations.

- See more at: http://huntmyideas.weebly.com/blog/ios-interview-questions-with-answers-part3#sthash.AhmzVlAh.dpuf


0 0