Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ IOS interview questions Summary     - in no backup ex: error: Xin Tourou ah backup child process has Singles DAT / US person / bin / in no backup ex (Database)

- Linux based exercises, interview questions (Linux)

- Go constructed using an interpreted language (Programming)

- Https (SSL / TLS) Detailed principles (Server)

- Using the Android interface in Parcelable (Programming)

- RHEL / CentOS / Fedora Install Nagios 4.0.1 (Linux)

- Binding unofficial Google Drive and Ubuntu 14.04 LTS (Linux)

- DVD production using CentOS installation source within the company Yum (Linux)

- Gitlab installation under CentOS 7 (Linux)

- MariaDB 10 Multi-source replication (Database)

- Nagios (centreon) monitoring LVS (Server)

- C ++ Supplements - locates the new expression (Programming)

- Linux dd command make U disk boot disk (Linux)

- Commentary Apache + Tomcat + JK implement Tomcat clustering and load (Server)

- Linux user login ban (Linux)

- Based kubernetes Construction Docker Cluster Management Comments (Server)

- Compare Oracle MySQL (ICP) index condition pushdown is described (Database)

- Elasticsearch 2.20 Highlight (Server)

- Use Oracle 11g show spparameter command (Database)

- Oracle create user authorization and in PLSQL (Database)

 
         
  IOS interview questions Summary
     
  Add Date : 2018-11-21      
         
         
         
  Before seen a lot of interview questions, feel either not enough or too redundant, so I will be online for some of the iOS face questions were cut and rearranged, and now to others.

1. Object-c class multiple inheritance can it? Why can implement multiple interfaces? What Category is? Way to rewrite a class inheritance good or better classification? Why?

A: Object-c class not multiple inheritance; can implement multiple interfaces, multiple interfaces can be done by implementing multiple inheritance in C ++; Category is the category, generally with good classification with Category rewriting class methods, only the category of effective, does not affect other existing classes and class relations.

2. #import with #include and what is the difference, @ class it, #import <> with #import "and what is the difference?

A: #import import keyword Objective-C header files, # include a C / C ++ header files imported keywords use #import headers automatically import only once and will not repeat the import, the equivalent of #include and # pragma once; @class tell the compiler to declare a class that, when executed, only to see the implementation of the file class can solve the header file that contains mutual; #import <> header file contains the system used, # import "" used to include user header files.

3. Properties readwrite, readonly, assign, retain, copy, nonatomic what role each is, in that case use?

answer:

When you need to generate getter and setter methods;. 1) readwrite is readable and writable characteristics

. 2) readonly is read-only properties generated getter method does not generate a setter method; you do not want to change the properties outside the class

. 3) assign an assignment feature, setter method incoming parameters assigned to the instance variables; setting variables only;

. 4) retain expressed hold characteristic, setter method will first pass retention parameters, by assignment, will pass retaincount +1 parameters;

. 5) copy for assignment feature, setter method to pass a copy of the object; you need a completely new variable.

6) .nonatomic non-atomic operations, generated by the compiler determines whether setter getter is atomic, atomic represents multi-threaded safe, general use nonatomic

4. Write a setter method for accomplishing @property (nonatomic, retain) NSString * name, write a setter method for accomplishing @property (nonatomic, copy) NSString * name

answer:

- (Void) setName: (NSString *) str

{

[Str retain];

[Name release];

name = str;

}

- (Void) setName: (NSString *) str

{

id t = [str copy];

[Name release];

name = t;

}

5. For a statement NSString * obj = [[NSData alloc] init]; obj at compile time and run time are what type of object?

A: compile time NSString type; the runtime type of the object NSData

6. The common data type object-c are those basic data types, and C, what is the difference, such as:? NSInteger and int

A: object-c data types NSString, NSNumber, NSArray, NSMutableArray, NSData, etc., these are the class, after the object is created, and the basic data type int C language, but certain bytes of memory space, use storing values; NSInteger is the basic data type is not a subclass NSNumber, of course, is not a subclass of NSObject. NSInteger basic data types Int or Long aliases (NSInteger definition typedef long NSInteger), which difference is, NSInteger system is based on 32-bit or 64-bit int to decide itself or Long.

Object 7.id declared what features?

A: Object Id declares a characteristic runtime, which can point to any type of object objcetive-c's;

8.Objective-C how memory management?

A: Objective-C memory management there are three main ways ARC (Automatic Reference Counting), MRC (manual memory count), autorelease (auto-release pool).

9. atoms (atomic) with non-atomic (non-atomic) property What is the difference?

answer:

1). Atomic provide multi-thread safe. Is to prevent another thread to read the writing is not completed when the data errors

2) non-atomic:. In its own memory management environment, parsing accessor retention and automatic release value returned if you specify nonatomic, then the accessor simply returns this value.

Several principles 11. The memory management when what? Those objects need to manually release the keyword generated by default rule? Binding property in and when and how to effectively avoid memory leaks?

A: Who apply, who released

Follow the principle of using the Cocoa Touch;

Memory management is mainly to avoid "premature release" and "memory leaks", for "premature release" needs attention @property feature set, be sure to use the characteristics of a keyword, for "memory leaks", must apply for a responsible release, be careful.

Object Key alloc or new needs generated by the release of the manual;

Set the correct property attributes need to retain release in the right place,

12. How iOS device performance testing?

A: Profile-> Instruments -> Time Profiler

13. Object C in what way is to create a thread? If you execute the code in the main thread, the method is what? If you want to delay the implementation of the code, the method is what?

A: There are three ways to create a thread: Use NSThread create, use GCD's dispatch, using subclassing NSOperation, then added NSOperationQueue; executing code in the main thread, the method is performSelectorOnMainThread, if you want to delay the implementation of the code can be used performSelector: onThread: withObject: waitUntilDone:

What 14. MVC design pattern? What are you familiar with design patterns?

answer:

Design Patterns: not a new technology, but the basic means of coding experience, the use of such an interface, iphone in the agreement, the java inheritance, etc., with more mature logic to handle a certain type of thing, summary the so-called design patterns. Object-oriented programming, java has summarized 23 design patterns.

mvc design pattern: Model, View, Controller, the entire application can be mentally divided into three blocks, corresponding to the storage or processing of the data is, front display, business logic control. Iphone own design idea is to follow mvc design pattern. It does not belong to the 23 design patterns category.

Proxy mode: Proxy mode for a particular object provides a proxy object, the proxy object controlled by reference to the source object, such as a factory product, does not want to sell directly to users, but to engage in a lot of agents, users can directly. find agents to buy things, agents from the factory purchase. common, such as QQ automatic reply belongs interception proxy, the proxy model has been widely used in the iphone.

Singleton pattern: that white is not a class object is created by alloc way, but with a static method returns objects of this class. The system only need to have a global object, this will help us to coordinate the overall system behavior, such as want to get [UIApplication sharedApplication]; calls anywhere can get UIApplication the object that is globally unique.

Observer pattern: When an object is changed, it will notify all observers to observe the object allowed to react. Nothing more than to implement all observers object to the object when the object is changed, it will call all observers object traversal methods to call the observer so as to achieve the purpose of the notification of the observer.

The factory pattern:

public class Factory {

public static Sample creator (int which) {

if (which == 1)

return new SampleA ();

else if (which == 2)

return new SampleB ();

}

}

The difference between deep and shallow copy 15 copy?

A: Shallow copy: just copy the pointer to the object, rather than copying the referenced object itself.

Deep Copy: Copy reference object itself.

A mean to say I have an object, the object obtained after A_copy after copy, copy it to the light, and A_copy A pointing to the same memory resources, replication is just a pointer to the object itself resources

Or only one, and that if we modify operation is performed on A_copy, then find the same object A references are modified, this is actually a thought contrary to our replicated copies. Deep copy like to understand, in the presence of a memory

Two separate object itself.

With a buddy online popular words that will:

Shallow copy just like you and your shadow, you are finished, your shadow is undone

Deep copy like you and your clone, you finished your human cloning is still alive.

16. Class action? What is the difference between inheritance and Categories in implementation?

A: The next category can not learn, do not change the original code is entered, the case of adding new methods, can only add, not delete modify, and if the original category and class method produces a name conflict, the category will overwrite the original method as having a higher priority class.

There are three main categories of action:

1). The implementation class dispersed into different files or more different frames.

2) Create the former private methods to reference.

3) Adding an informal agreement to an object.

Inheritance can add, modify or delete method, and can increase the property.

17. category and class extends difference.

A: The difference is that the latter category and extensions can add attributes. Also added is the latter method must be implemented.

extensions can be considered a private Category.

What is the difference in the interface 18. oc concepts and protocols in java?

A: OC proxy has two layer of meaning, the official definition of formal and informal protocol. Like the former, and Java interfaces.

The method belongs to the informal protocol design pattern to consider the scope, not necessarily to achieve, but if you have to realize, it will change the attributes of the class.

In fact, on a formal agreement, categories and informal agreements earlier study when I'm generally seen, also written in a tutorial learning

"The concept of informal agreement category is actually another way of expression," Here are some ways you might want to achieve, you can use them a better job. "

This means that these are optional. For example, I am the door to a better way, we will affirm such a category to achieve. Then you can use them directly in a better way late.

So look, always feel a bit like this stuff category optional protocol agreement. "

Now, in fact, we have already begun to protocal both unified and standardized-up operation, because the information says "informal agreement to use interface modification"

Now we see the agreement of the two qualifiers: "must be implemented (@requied)" and the "alternative implementations (@optional)".

19. What is the KVO and KVC?

A: KVC: key - value coding is a property of an indirect access to the object using a string to identify the property, not by calling the access method, or directly accessed through instance variables mechanism.

In many cases you can simplify the code. apple document actually gave a good example.

KVO: key observation mechanism, he provides a method to observe a property changes, greatly simplifies the code.

Specific use see ah ha had used the place for a click button state change monitoring.

For example, I have a custom button

[Self addObserver: self forKeyPath: @ "highlighted" options: 0 context: nil];

#pragma mark KVO

- (Void) observeValueForKeyPath: (NSString *) keyPath ofObject: (id) object change: (NSDictionary *) change context: (void *) context

{

if ([keyPath isEqualToString: @ "highlighted"]) {

[Self setNeedsDisplay];

}

}

The system is based on keypath to get to the corresponding value changes, and the truth is on the kvc mechanism is the same.

Kvc mechanism for how to find the key value:

"When calling by KVC objects, such as: [self valueForKey: @" when someKey "], the program will automatically attempt to resolve the call by several different ways to find the first object is someKey with this method, if not found, it will. continue to find whether the object with someKey instance variable (iVar), if it is not found, the program will continue to attempt to call - (id) valueForUndefinedKey:. this method, if this method is not implemented, the program will throw an exception error NSUndefinedKeyException .

(Cocoachina.com Note:. Key-Value Coding method to find the time, not only will look someKey this method, this method will find getsomeKey, preceded by a get, or _someKey and _getsomeKey these forms at the same time, find an instance when the variable will not find someKey this variable, the variable will find _someKey exists.)

Design valueForUndefinedKey: The main purpose of the method is that when you're using - (id) valueForKey method request from the object value, the object can be before the error occurs, there is a final opportunity to respond to the request. This has many benefits, the following two examples illustrate the benefits of doing so. "

Come from cocoa, this argument should be quite reasonable.

Because we know there is a button is highlighted instance variable, so why above we just add a related keypath on the line,

Can be logically understood kvc find, say past.

20. The role of the agent?

A: The purpose of the agent is to change or transfer control chain. Allow a class at some particular time notice to the other classes, those classes without the need to obtain a pointer. It can reduce the complexity of the frame.

In addition, the broker can be understood as a similar java callback listener mechanism.

21. oc can be modified and can not be modified types.

A: You can modify the unmodifiable collections. My personal understanding is that this simply can not be dynamically add, modify and dynamically add, modify same.

Such as NSArray and NSMutableArray. The former controls after initialization memory is fixed immutable, which can add, etc., can apply for a new dynamic memory space.

22. We say oc is a dynamic language runtime What does it mean?

A: polymorphism. It is mainly determined by the type of data compilation, deferred to runtime.

This question relates to light two concepts, runtime, and polymorphism.

In simple terms, the runtime mechanism allows us to determine until run category of an object, and the class of the object specified method call.

Polymorphism: different objects in their own way the ability to respond to the same message is called polymorphism. Meaning that hypothesis in biology (life) are used in the same manner a -eat;

It belongs to the human organism, belongs to biological pigs have inherited after life, achieve their eat, but the call is that we eat simply call their methods.

That is a different object in its own way responded to the same message (responds eat this selector).

Thus it can be said, the runtime mechanism is a multi-state basis? ~~~

23. The difference between notifications and agreements?

A: The protocol control relationship chain (has-a), the notification no.

First, I do not quite understand the beginning, what is the control chain (jargon of the ~). But notice patterns of behavior and acting under a simple analysis, we can generally have their own understanding

In simple terms, notice, then it can be one to many, a message can be sent to multiple recipients of the message.

Acting according to our understanding, not to directly say not many, for example, we know that the star economic agents, often a person in charge of economic affairs of several stars.

Just for different star, object proxy things are not the same, one to one, that day can not be processed A star to a conference to deal with the news conference after the issue of the agent, the nickname B

The conference. However, notification is not the same, he only cares about giving notice, without regard to how much interest received to be processed.

Therefore, the control chain (has-a roughly can be seen from the English words, single owned and controlled correspondence.

24. What is a push message?

A: Push notification is more a technology.

Simple point is a means of client access to resources.

Under ordinary circumstances, the client is active pull.

Push is a server-side active push. Test push implementation to see the blog.

25. With regard to polymorphism

A: polymorphism, a subclass can be assigned a pointer to the parent class.

The subject can actually out to all object-oriented languages,

So on polymorphism, inheritance and encapsulation preferably has a basic understanding of self-awareness, it is not written on the book sure to be able to back out data

26. For a single example of understanding

A: In order to achieve objective-c in a singleton class, you need to do at least the following four steps:

1). Implemented as a static singleton object instance and initialize it, and set to nil,

2) implement an instance constructor to check the above statement static instance is nil, if it is present and returns a new instance of the class,

3) Rewrite allocWithZone method used to ensure that other people directly alloc and init trying to get a new strength of the time does not create a new instance,

4) Appropriate achieve allocWitheZone, copyWithZone, release and autorelease.

27. In response to talk about chain

A: The incident response chain. Including a click event, the screen refresh events. In view of the stack from top to bottom, or spread from above.

It can be said distribution point events, transfer and handling. Concrete can look to touch this event. Because of the abstract ask

Serious doubts about the subject back to the more general.

From the chain of responsibility pattern, in terms of incident response chain through processing, which has scalability

28. frame and bounds What is the difference?

A: frame means: The view in the parent view coordinate system location and size. (Reference point is the father of the coordinate system)

bounds means: The view in itself coordinate system location and size. (Reference point is the coordinate system itself)

29. What are the different methods and selectors?

A: selector is the name of a method, method is a combination which contains the name and realized.

For more details, you can see apple document.

30. OC garbage collection?

A: OC2.0 have Garbage collection, but the iOS platform does not provide.

Generally, we understand the objective-c for memory management are manually operated, but there are also auto-release pool.

However, most of the difference between information, seemingly not enough to confuse and arc mechanism.

31. NSOperation queue?

A: The store NSOperation collection classes.

Operation and operation queue, which can be seen in the concept of java threads and thread pools. Ios for processing multithreaded development issues.

The online part of the information mentioned in point is that, although the queue, but not with the concept of a queue, is not put into operation according to strict advanced emerged.

Here there is a doubt for the queue, the concept of FIFO is Afunc added to the queue, Bfunc also followed into the queue, Afunc first implementation of this is inevitable,

But Bfunc is completely finished and other Afunc after operation, B only started and executed, so the concept of chaos on the queue a little contrary to the concept of multi-threaded processing.

But then I thought actually refer to the bank's tickets and calling system.

So for A than B, but B to line up for the tickets after the first implementation of the operation, we can versa inductive think this is a queue.

But then to see a vote on this operation queue topic of the article, which referred to a

"Because of the two operations submitted close intervals threads in the pool, the first to start is uncertain."

The queue name instantly feel a little bit Bluff, not as pool ~

Comprehensive, we know that he can use a relatively large group that can help multithreaded programming just fine.

32. What is the delay in loading?

A: The lazy mode, just before going to use the initialization time.

Also it is understood as delay loading.

I think the best and easiest is a Liezi tableView loading pictures show.

A carrier delay, to avoid excessive memory, an asynchronous load, to avoid clogging the thread.

33. Are two tableview controller embedded in a view controller?

A: A view control provides only a View view, in theory, a tableViewController can not put it,

I can only say that can be embedded in a tableview view. Of course, the title itself is ambiguous, if not qualitative thinking we think UIViewController, but macro view showing the controller, that we have been able to view it as a controller, it can control more than one view controller, such as TabbarController a feeling of.

34. Has a tableView can be associated with two different data sources? How would you deal with?

A: First, we look at the code, how to associate the data source on the proxy method is in fact associated data source in implementation.

Therefore, we do not care about how to associate him, how he related, the method just let me return to their own needs to set as the associated data source.

So, I think we can set up multiple data sources ah, but there is a problem is that it is you wanted to do Mani? How do you want to display a list of the different data sources displayed in chunks?

35. When using NSMutableArray, when to use NSArray?

A: When the program is running in the array, changing needs, using NSMutableArray, when the array after initialization, will no longer be changed, use NSArray. It should be noted that the use of NSArray is only that the array does not change at runtime, that can not go in the array NSAarry add and delete elements, but does not indicate which content elements within the array change can not occur. NSArray is thread-safe, NSMutableArray not thread-safe, the use of multiple threads to NSMutableArray need attention.

36. The example is given delegate method, and say UITableVIew the Data Source Method

A: CocoaTouch framework uses a lot of trust, which is a typical application UITableViewDelegate commissioned mechanism, is a typical usage commissioned to implement the Adapter pattern, which is the target UITableViewDelegate agreement, tableview is the adapter to achieve UITableViewDelegate agreement, and sets itself to talbeview the delegate object, the adapter is, in general, the object is UITableViewController.

UITableVIew the Data Source methods - (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) section;

- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath;

37. You can create as many autorelease objects in the application, whether the restrictions?

Answer: No

38. If we do not create a memory pool, if there is a memory pool available to us?

A: The UI thread maintains its own memory pool, the data user to create their own thread, you need to create a thread pool of memory

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

A: The data you create your own threads, you need to create the thread pool of memory

40. The method of NSObject class that is often used?

A: NSObject Objetive-C is the base class, which consists of a series of agreements and NSObject class.

Where the class method alloc, class, description object methods init, dealloc, - performSelector: withObject: afterDelay: the like are often used

41. What is the simple construction method?

A: The simple construction method is generally provided by CocoaTouch framework, such as the NSNumber + numberWithBool: + numberWithChar: + numberWithDouble: + numberWithFloat: + numberWithInt:

Foundation classes are most simple construction method, we can by a simple construction method, we get the system to create a good object, and does not require manual release.

42. How to use Xcode design a common application?

A: Use the MVC design pattern applications, Model complete detachment layer interface, namely Model layer that can run on any device, in the controller layer, according to the iPhone and iPad (exclusive UISplitViewController) different features to choose different objects viewController . In the View layer, according to the practical requirements, to design, the design of which xib file, set it as universal.

43. UIView animation effects are those?

A: There are many, such as UIViewAnimationOptionCurveEaseInOut UIViewAnimationOptionCurveEaseIn UIViewAnimationOptionCurveEaseOut UIViewAnimationOptionTransitionFlipFromLeft UIViewAnimationOptionTransitionFlipFromRight UIViewAnimationOptionTransitionCurlUpUIViewAnimationOptionTransitionCurlDown

44. How to save data in the iPhone app?

A: There are several preservation mechanisms:

1) through web services, saved on the server

2) By NSCoder curing mechanism, the object is stored in a file

3) By SQlite CoreData saved in a file or database

45. What is coredata?

A: coredata Apple to provide a data storage framework, based SQlite

46. What is NSManagedObject model?

A: NSManagedObject is a subclass of NSObject, but also an important part of coredata, which is a generic class that implements the basic functions required core data model layer, users can subclass NSManagedObject, to build their own data model.

47. What is NSManagedobjectContext?

A: The interaction between NSManagedobjectContext object is responsible for applications and databases.

48. What is a verb?

A: predicate by NSPredicate, is given by the logical condition as constraints to complete the data filtering.

predicate = [NSPredicate predicateWithFormat: @ "customerID ==% d", n];

a = [customers filteredArrayUsingPredicate: predicate];

49. coredata together and what kinds of persistent storage mechanism?

A: The stored to a file stored to NSUSErDefaults (plist file system), deposited into Sqlite database file

50. talk about Block understanding? And write using a Block execution UIVew animation?

A: Block anonymous function is to get the other functions of local variables, which not only facilitate the development, and can significantly improve the efficiency of application (multi-core CPU can deal directly with Block instruction)

[UIView transitionWithView: self.view

duration: 0.2

options: UIViewAnimationOptionTransitionFlipFromLeft

animations: ^ {[[blueViewController view] removeFromSuperview]; [[self view] insertSubview: yellowViewController.view atIndex: 0];}

completion: NULL];

51. Write the code above definitions of Block.

answer:

typedef void (^ animations) (void);

typedef void (^ completion) (BOOL finished);

52. Try using + beginAnimations: context: Block and the definition above, and can write a complete

+ (Void) transitionWithView: (UIView *) view duration: (NSTimeInterval) duration options: (UIViewAnimationOptions) options animations: (void (^) (void)) animations completion: (void (^) (BOOL finished)) completion NS_AVAILABLE_IOS ( 4_0); operative function operation

Answer: No

53. The project is done related to network access, what subjects completed network functions?

A: ASIHTTPRequest and NSURLConnection

54. Under brief NSURLConnection class and + sendSynchronousRequest: returningResponse: error: and - initWithRequest: delegate: the difference between the two methods?

A: NSURLConnection mainly used for network access, including + sendSynchronousRequest: returningResponse: error: is synchronous access data, that is, the current thread is blocked and waiting to return to the response request, and - initWithRequest: delegate: using asynchronous loading, when it Upon completion of network access, through delegate back to the main thread, the object and its delegate.

55. What is multi-threading

A: Multithreading is a complex concept, literally it means synchronization is complete multiple tasks, improve the efficiency of resource use, to see from the hardware, operating system, application software, a different perspective, multithreading be given a different connotation for hardware , now available in most of the CPU is multicore, multi-threaded multi-core CPU computing even better; from the perspective of the operating system, multitasking, now with the mainstream operating systems are multi-tasking, you can listen to songs while writing blog; for applications, multi-threaded application that allows a faster response, you can download the network, while responding to the user's touch operation. In iOS applications, multi-threaded initial understanding, is complicated by its original meaning is to do first boil, and then pick vegetables, then stir-fry the work will go pick vegetables into boiling water at the same time, and finally to cooking.

56. iOS Multithreading

A: iOS multi-threaded, multi-threaded under the Cocoa framework, by Cocoa package, allows us to be more convenient to use threads, did the students may have C ++ thread has more understanding, such as thread creation , semaphores, shared variables have a good understanding, it will be a lot easier next Cocoa framework, it made a thread package, some packages, allowing us to create an object in itself will have a thread, the thread is the object of the abstract, thus reducing our engineering, provider robustness.

GCD is (Grand Central Dispatch) acronym from an easy-to multithreaded libraries to provide system-level, with the characteristics of run-time, and can take full advantage of multi-core hardware. GCD API interface as a function of the C language function parameters majority have Block, Block's see here on the use, provide powerful "Interface" for us to use GCD see this article

NSOperation and Queue

NSOperation is an abstract class that encapsulates the details of the implementation of the thread, we can subclass the object, plus NSQueue to the same object-oriented thinking, managing multi-threaded programs. Concrete can be found here: a project NSOperation multi-threaded network access based.

NSThread

NSThread thread of execution is an object of control, it is better to NSOperation abstraction, through which we can easily get a thread, and control it. However, concurrency control NSThread between threads, is the need to control our own can be realized by NSCondition.

See iOS multi-threaded programming using the NSThread

Other Multithreading

In the framework of Cocoa, notices, Timer and asynchronous functions, and so has the use of multi-threading, (to be added).

57. When did the project choose to use GCD, When selected NSOperation?

A: The advantage of using NSOperation project is NSOperation thread is highly abstract and use it in a project, program structure will better project subclass NSOperation design ideas, is an object-oriented advantages (reuse, package), so as to achieve multi-threaded support, and the interface is simple, it is recommended to use in complex projects.

Advantage of the project is to use GCD GCD itself is very simple, easy to use, not for complex multi-threaded operation, will save the amount of code while using Block parameter, the code will be more readable, it is recommended to use in simple projects.

58. What is the block

A: For closures (block), there are many definitions, wherein the closure is to be able to read the function of other variables inside a function, this definition that is closer to nature and better understanding. For students new to Block, will feel a little around, because we are used to write such a program main () {funA ();} funA () {funB ();} funB () {... ..}; is the main function calls a function, function a calls function B ... functions are executed in sequential order, but in reality this is not all, for example, a project manager M, men have three programmers a, B, C, and when he realized the programmer a schedule function F1 when he is not waiting for A after the completion of arrangements B go to achieve F2, but arranged for A function F1, B function F2, C functions F3, and then possibly to write technical documents, and when A encounter problems, he will come to the project manager M, B when finished, will inform M, which is an example of an asynchronous execution. In this case, Block can flourish, because the project manager M, A time schedule for the work, and it will tell A Ruoguo difficulties, how can we find him reporting issues (such as playing his phone number), which is the project manager M to a callback interface a, and to back out of the operations, such as receiving the call, after Baidu query, returning web content to a, which is a Block, when working in M confessed, has been defined, and has made the F1 task number (local variables), but it is at the time when the a encounter problems, just call execution, cross-function project manager M Baidu query, the results obtained after the callback that block.

59. block principle

A: Objective-C is a C language extensions, block implementation is based on pointers to functions.

Calculated from the development of language, first goto, high-level language pointer to the object-oriented language block, from the machine thinking, one step closer to human thinking, in order to facilitate a more efficient developer, directly describe the reality of logic ( demand).

Example

Call the next cocoaTouch frame animation of the Block

Use typed statement block

typedef void (^ didFinishBlock) (NSObject * ob);

This declares a didFinishBlock type of block,

You can then use

@property (nonatomic, copy) didFinishBlock finishBlock;

Declare a blokc objects, pay attention to the object attribute is set to copy, receive block parameters, it will automatically copy.

__block is a special type,

Use the keyword to declare a local variable that can be changed by block, and its value in the original function will be changed.

60. With regard to block

A: When the interview, the interviewer will first ask whether understand block, if used block, the equivalent of opening these issues, often the beginning of the following series of questions, so be sure to answer truthfully according to their own situation.

1) Use the block and use delegate complete entrusting mode What are the advantages?

We must first understand what is entrusting mode, entrusting mode large number of applications in iOS, which is the adapter schema object adapter in design mode, Objective-C type id used to point all the objects so entrusting mode is more concise. Learn the details of entrusting mode:

iOS Design Patterns - entrusting mode

Use block delegates the implementation mode, the advantage of block in the block of code defines a callback delegate object inside a function, make the code more compact;

Adapted object no longer need to implement a specific protocol, the code more concise.

2) Multi-threaded and block

GCD and Block

Use dispatch_async series method, you can perform in the manner specified block

GCD programming examples

The full definition dispatch_async

void dispatch_async (

dispatch_queue_t queue,

dispatch_block_t block);

Function: Submit asynchronous execution of a block in the specified queue, do not block the current thread

By controlling the queue thread block execution. The main thread of execution previously defined objects finishBlock

dispatch_async (dispatch_get_main_queue (), ^ (void) {finishBlock ();});

62. talk about memory management and process Object-C's?

Answer: 1) When you use a new, alloc, and copy method to create an object that reservation counter value of 1. When you no longer use the object, you are responsible to the object to send a release or autorelease message. Thus, the object will be destroyed at the end of life.

2) When you get an object by any other method, it is assumed that the object is to retain the counter value of 1, and has been set to automatically release, you do not need to take any action to ensure that the object is cleaned up. If you are going It owns the object over a period of time, the need to preserve it and make sure it is released when the operation is complete.

3) If you keep an object, you need to (eventually), or deactivate the object must be maintained using a number of methods retain and release methods are equal.

63.Object-C has a private way? Private variables?

A:. Objective-c - class inside the method are only two static methods and instance methods It seems not a complete object-oriented, and in accordance with the principles of OO is an object exposed only useful thing if there is no private methods, then. for some small-scale code reuse is not so effortless in the fame class inside a private method

@interface Controller: NSObject {NSString * something;}

+ (Void) thisIsAStaticMethod;

- (Void) thisIsAnInstanceMethod;

@end

@interface Controller (private) -

(Void) thisIsAPrivateMethod;

@end

@private private variables can be used to modify

In Objective-C, all instance variables are private by default, all instance methods are public by default

64.Object-C how to inherit it? If not, use instead? cocoa in all classes are subclasses of NSObject

A: Here is multiple inheritance protocol to achieve agency

You do not have to consider the complicated multiple inheritance, virtual base class concept.

Ood polymorphic properties in obj-c is achieved by the commission.

65. The memory management Autorelease, retain, copy, assign the set and meaning?

A: 1) You initialize (alloc / init) object, you need to release (release) it. E.g:

NSMutableArray aArray = [[NSArray alloc] init]; required after [aArray release];

2) you retain or copy, you need to release it. E.g:

[AArray retain], we need to [aArray release];

3) is transmitted (assign) an object, you need to retain and, where appropriate, of release. E.g:

obj2 = [[obj1 someMethod] autorelease];

2 receives a target object is automatically released 1 value, or pass a basic data types (NSInteger, NSString) when: You want to target 2 or retain, to prevent it before it is used is automatically released. But after retain, must be released at the appropriate time.

About index count (Reference Counting) problems

retain value index = count (Reference Counting)

NSArray objects retain (retain value plus one) of any objects in the array. When NSArray is unloaded (dealloc), when all the objects in the array will be executed once released (retain value minus one). Just NSArray, any collection class (Collection Classes) perform similar operations. For example NSDictionary, even UINavigationController.

Object Alloc / init established index count is 1. No need to once again retain.

[NSArray array] and [NSDate date] and other "method" to establish an index of 1 count of objects, but also an automatic release objects. So is a local temporary object, so it does not matter. If it is intended to variable (iVar) used in the whole Class, you must retain it.

The default class method returns a value are executed with "automatic release" method. (* As of NSArray)

In class uninstall "dealloc" in, release all non-balanced NS objects. (* All is not autorelease, and retain the value of 1)

66. C and obj-c how to mix

A: 1) the compiler processes suffix .obj-c as m file, you can identify the obj-c and c code files can be processed mm recognize obj-c, c, c ++ code, but must only be used cpp file c / c ++ code, and cpp files include header files, not obj-c code is present, just because cpp cpp

2). In mm mix cpp file can be used directly, so obj-c mix cpp is not a problem

3). Mix obj-c is actually using modules written in obj-c cpp is what we want.

If the module class implementation, then to write according to cpp class standard definition of the class, what obj-c header file can not appear, including the #import cocoa. Implementation file, namely the class implementation code can use something obj-c, and can import, but the suffix is mm.

If the module to achieve the function, then the header file format according to c declare the function, implementation file inside c ++ functions can obj-c, but the suffix or mm or m.

Summary: Whatever we cpp cpp include files and the file does not contain the obj-c can be used, cpp mix key obj-c is to use the interface and implementation code can not be used directly, in fact cpp mix is obj-c compiled o file, this thing is actually no difference, it can be used. obj-c compiler support cpp

67. Objective-C difference between stack and heap?

A: management: in terms of the stack, is managed automatically by the compiler, we do not need manual control; For a heap, the release of the work by the programmer control, prone to memory leak.

Application Size:

Stack: In Windows, the stack is extended to low-address data structure is a contiguous area of memory. What this means is the maximum capacity of the stack address and stack predetermined system is good, in WINDOWS, the stack size is 2M (some are said to 1M, in short, is a compile-time constants determined), if when applying space than the remaining space stack you will be prompted to overflow. Thus, the space obtained from the stack smaller.

Heap: heap is extended to high-address data structure is not continuous memory area. This is because the system is used to store the list of free memory address, of course, is not continuous, and the list traversal direction is from low to higher addresses. Heap size is limited by the computer system and effective virtual memory. Thus, stack space to get more flexible, is relatively large.

Debris problem: For a heap in terms of frequent new / delete will inevitably lead to discontinuity of memory space, causing a lot of debris, so the program efficiency. For the stack is concerned, you will not have this problem, because the stack is a last-out queue, they are so one to one that will never have a memory block pop-up from the middle of the stack

Distribution: heap is allocated dynamically, not statically allocated heap. There are two kinds of stack allocation: static allocation and dynamic allocation. Static allocation is performed compiler, such as the allocation of local variables. Dynamically allocated by alloca allocation function, but dynamic stack and heap allocation is different, his dynamic allocation is performed by the compiler release, we do not need to manually implement.

Allocative efficiency: the machine is provided by the system stack data structure, the computer at the bottom of the stack provides support: a special allocation register contains the address of the stack, the stack push has specialized instruction, which determines the stack more efficient . Heap is a C / C ++ library provides, and its mechanism is very complex.

68. ViewController of didReceiveMemoryWarning how is called:

A: [supper didReceiveMemoryWarning];

69. When using the delegate, when to use Notification?

A: delegate for one-to-one relationship for the reciever sender receives a function feedback.

notification for one-to-one / many / none, reciver, an event for notifying the plurality of object.

70. The preprocessor directive #define statement with a constant that returns the number of seconds (ignoring leap year issue) in one year

answer:

#define SECONDS_PER_YEAR (60 * 60 * 24 * 365) UL

I would like to see a few things:

#define basics of grammar (for example: it can not end with a semicolon, use of brackets, etc.)

You will know how to calculate the value of a preprocessor constant expression, so how do you write directly to calculate the number of seconds in a year instead of calculating the actual value is more clear and without cost.

Aware of this expression will cause a 16-bit machine integer overflow - so use to sign long integer L, tells the compiler that this is a long integer constant.

If you use your expression UL (unsigned long integer), then you have a good starting point. Remember, first impressions are important.

71. Write a "standard" macro MIN, the macro input two parameters and returns the smaller one.

answer:

#define MIN (A, B) ((A) <= (B) (A):? (B))

This test is for the purpose of the following set of:

#define Identified in the basics of macro applications. This is very important, because until embedded (inline) operator becomes part of the standard C macro is the only way to produce easy embed code

law,

For embedded systems, in order to meet the performance requirements of embedded code is often necessary method.

Triple conditional operator knowledge. This operator exists in C language because it allows the compiler to generate more optimized than the if-then-else code to understand the usage is very important.

Carefully to understand the macro parameters in parentheses

I also started to discuss this issue with the macro side effects such as: When you write the following code what will happen?

least = MIN (* p ++, b);

The result is:

((* P ++) <= (b) (* p ++):? (* P ++))

This expression can cause side effects, pointer p ++ increment will make three operations.

72. What are the implications const keyword? ? There modified class action it? Static role for the class it extern c

answer:

const means "read only", the following statement is what does this mean?

const int a;

int const a;

const int * a;

int * const a;

int const * a const;

The first two effects are the same, a is a constant integer.

The third means a is a constant integer pointer (that is, the integer is not modified, but the pointer).

The fourth means is a pointer to a pointer to a constant integer (that is, an integer pointer can be modified, but the pointer can not be modified).

The last point means that a is a constant pointer to constant integer (that is, an integer pointer can not be modified, while the pointer is non-modifiable).

in conclusion:

Const keyword role is to give people read your code to convey useful information, in fact, declare a parameter const tells the user application purpose of this parameter.

If you have spent a lot of time to clean up the garbage left by other people, you will quickly learn to appreciate this extra information. (Of course, know how to use const, rarely leave a mess for others to clean up) by giving the optimizer some additional information, use the keyword const may be able to produce more compact code. Rational use of the const keyword allows the compiler to naturally protect those who do not wish to change the parameters, modify the code to prevent it being unintentionally. In short, thus reducing the bug occurs.

1). To prevent a variable is changed, you can use the const keyword. First when defining the const variable, generally it needs to be

Initialization, because since there is no chance to go back and change it;

2) For a pointer, the pointer itself can be specified as const, you can also specify the data pointer is const, or both finger

As const;

3) In a function declaration, const parameters can be modified to indicate that it is an input parameter within the function can not change its value;

4) For the class member functions, if designated as a const type, it indicates that it is a constant function, can not modify member variables of the class;

5) For the class member functions, and sometimes you must specify the type of return value const, so its return value is not "left value."

73. What are the implications volatile keyword? And give three different examples.

A: A volatile variable is defined that this variable may change unexpectedly, so the compiler will not make assumptions about the value of this variable. Precisely that, the optimizer must always be carefully re-read the value of this variable when this variable is used instead of the backup stored in the register.

Here are a few examples of volatile variables:

Parallel device hardware registers (eg: status register)

An interrupt service routine will have access to the non-automatic variable (Non-automatic variables)

Multi-threaded application variables are shared by several tasks

74. The argument can be either a const can also be volatile it? A pointer can be volatile? Explain why.

A: 1) yes. An example is the read-only status register. It is volatile because it may change unexpectedly. It is const because the program should not attempt to modify it.

2) Yes. Although this is not very common. An example is when an interrupt service routine modifies a pointer to a buffer pointer.

. 75 static key role:

answer:

1) The role of the range of the in vivo function static variables for the function body, unlike auto variable, the variable memory is allocated only once,

Therefore, its value at the time of the next call will remain the previous value;

2) in the module's static global variables can be used to access functions within the module, but other functions can not be accessed outside the module;

3). Static function within the module can only be called by other functions within that module, the use of this function is limited to a statement

Its module;

. 4) static member variables in a class belongs to the class owned, all objects of the class only one copy;

5). Static member function in the class belongs to the entire class has, this function does not receive this pointer, static member variables which can only access the class.

76. The difference between threads and processes and contacts?

answer:

1). The basic unit processes and threads are made of the experience of the operating system programs that are running, the system uses the base unit for system application concurrency

2). The main difference between processes and threads is that they are different operating system resource management.

3). The process has a separate address space, after a process crashes, will not have an impact on other processes in protected mode, and the thread is a process different execution paths.

4.) thread has its own stack and local variables, but there is no separate address space between threads, a thread is equivalent to the entire process die die. So the program than multi-process multi-threaded program robust, but in the process of switching, consuming large resource efficiency to be worse.

5). But at the same time and have to share some of the requirements for concurrent operation of certain variables, only with the thread, the process can not be used.

77. Several processes include a synchronization mechanism, and compare their advantages and disadvantages.

A: The atomic spin lock semaphore mechanism tube, rendezvous, Distributed Systems

78. The way communication between processes

A: The shared storage system messaging system piping: The file system basis

79. The process deadlock reasons

A: The competition for resources and processes to promote illegal order

4 80. The necessary conditions for deadlock

A: exclusive, request remains inalienable, Loop

81. The process deadlock

A: ostrich policy, prevention strategies to avoid policy deadlock detection and lifting

82. cocoa touch framework

A: The basic framework for Cocoa Touch iPhone OS applications to reuse a lot of maturity model Mac systems, but it is more focused on the optimization of the interface and touch.

UIKit provides you with the basic tools to implement graphical, event-driven program on the iPhone OS, which is based on Mac OS X, and the same Foundation framework, including file processing, network, string manipulation and so on.

Cocoa Touch and iPhone users have a consistent interface to the special design. With UIKit, you can use a unique graphics interface controls, buttons, and features full-screen view on the iPhone OS, you can also use the accelerometer and multi-touch gestures to control your application.

UIKit framework in addition to an assortment of outside, Cocoa Touch framework contains all create a world-class iPhone application needs, from 3D graphics to a professional sound, even provide device access API to control the camera, through GPS or get the current position.

Cocoa Touch both contain just a few lines of code to complete the powerful Objective-C framework for all tasks, and also provide the basis for the C language API to directly access the system when needed. These frameworks include:

Core Animation: by Core Animation, you can through a combination of independent layers of simple programming model to create a rich user experience.

Core Audio: Core Audio is playing, processing and recording audio expertise to easily add powerful audio feature to your application.

Core Data: provides an object-oriented data management solution that is easy to use and understand, and even can handle any application, large or small data model.

Feature List: Classification Framework

Here is a small portion of Cocoa Touch frameworks are available:

Audio and Video: Core Audio, OpenAL, Media Library, AV Foundation

Data Management: Core Data, SQLite

Graphics and Animation: Core Animation, OpenGL ES, Quartz 2D

Network: Bonjour, WebKit, BSD Sockets

User applications: Address Book, Core Location, Map Kit, Store Kit

83. What is auto-release pool is and how to work

A: When you send an autorelease message to an object, Cocoa will be placed in a reference to the object to automatically release date it is still a legitimate object, so autorelease pool defined scope of another object can be to. it sends a message. When the program execution to the location of the end of the scope, auto-release pool will be released, all objects in the pool will be released.

The advantages and disadvantages of 84. Objective-C.

A: objc advantages:

1). Cateogies

2). Posing

3) Dynamic identification

4). Index Calculation

5) Flexible Messaging

6) Not an overly complex language derived from C

7) .Objective-C and C ++ programming can be mixed

objc Disadvantages:

1). Do not support namespaces

2) does not support operator overloading

3) does not support multiple inheritance

4) Use the dynamic run-time type, all methods are function calls, so a lot of compile-time optimization methods are used less. (Such as inline functions, etc.), poor performance.

85. sprintf, Something to note strcpy, memcpy use.

answer:

1). Sprintf is formatting functions. The piece of data through a specific format to a format string buffer to go. Length sprintf formatting functions can not be controlled, there may be formatted string would exceed the size of the buffer, causing an overflow.

2) .strcpy is a copy of the string functions, its function prototype is strcpy (char * dst, const char * src

The beginning of a string src to dst copy memory began to go to the end of the glyph '\ 0', since the length is not copied by our own control, so this string copy is error-prone.

. 3) memcpy function strings are with copy function, which is a memory copy function, and its function prototype for memcpy (char * dst, const char * src, unsigned int len); the length len of a section of memory, from src dst copy to go, the length of the function control. But there will be superimposed memory problems.

Effect 86. readwrite, readonly, assign, retain, copy, nonatomic property

A: @property is a property access statement supporting the following attributes with the extended number:

1) .getter = getterName, setter = setterName, set the setter and getter method name

2) .readwrite, readonly, set access levels for

2) .assign, setter method of direct assignment without any retain operations, in order to solve the original problem of the type of ring through references

3) .retain, setter method parameter release the old value and then retain the new value, relevant information (CC All implementations are in this order)

4) .copy, setter method Copy operation, and retain the same processing, the old value first release, then Copy the new object, retainCount 1. This is the context in order to reduce dependence on the mechanism introduced.

5) .nonatomic, non-atomic access, without synchronization, multi-threaded concurrent access to improve performance. Note that if you do not add this attribute, the default is two access methods are atomic transactional access. Lock object instance is added to your class.

87. The difference between http and scoket communications.

Answer: http client a request with the http protocol, it sends a request when needed package http request header, and bind the data request, the server generally has a web server with (of course, not absolute). http request method for the client initiated the request to the server to respond, then disconnect after a request is completed, in order to save resources. The server can not take the initiative to respond to the client (unless http long connection technology). iphone class is mainly used NSUrlConnection.

scoket the client with the server directly using socket "socket" connection, does not require the connection is disconnected, the client and server can stay connected channel, both parties can take the initiative to send data. Usually in stock or game development to develop such strong demand immediate and keep transmitting data than the larger occasions. The main use of the class is CFSocketRef.

The difference between 88. TCP and UDP

A: TCP stands for Transmission Control Protocol, the Chinese called transmission control protocol that provides a reliable, connection-oriented network data transfer services. Transmission Control Protocol mainly includes the following tasks and functions:

* Ensure successful delivery of IP datagrams.

* For large blocks of data sent by segmentation and reassembly.

* Make sure the correct order and delivered in order segmented data.

* By calculating the checksum integrity check data transmission.

TCP provides a connection-oriented, reliable data stream, while UDP provides a non-oriented connection, unreliable data streaming.

Simply put, TCP attention to data security, and UDP data transmission quickly, but security in general

89. You know svn, cvs version control tools such it?

A: The version control svn, cvs are two version control, we need to complete the relevant svn, cvs server.

scm is the place where xcode configured version control. Version control is a principle and b while developing a project, a day after the finish of the code to the code submitted to the server, b do when get the latest version from the server, you can then do it. If a and b must be submitted to the server, and also modify the same method, the code will generate conflict, if a first submission, then when b submission, the server can prompt code conflict, b can clearly see and do the corresponding modification or fusion then submitted to the server.

90. What is a push.

A: The client program to leave the back door port, the client is always listening for requests for the back door, so the server can proactively push messages like this port.

91. The static link library

A: This is the .a file, which is equivalent java package inside the jar, the classes are compiled into a package, in different projects if import this file can be used inside the class, the specific use is still #import "xx. H. "

92. fmmpeg framework

A: The audio and video codec framework, developed for internal use UDP protocol for streaming media, has opened up a six internal ports to receive streaming data to complete the purpose of rapid accepted.

93. fmdb framework

A: The database framework, sqllite data manipulation the package, use the focus to be put above sql statement.

94.320 frame

A: ui framework, introducing 320 projects as a framework for a common package as add frameworks. cover (open) flower frame (2d affine technology), the inner core class is CATransform3D.

94. What is the sandbox model? What action is part of a private api category?

A: an iphone project file operations have a designated position corresponding to this project, can not be crossed.

iphone sandbox model has four folders documents, tmp, app, Library, persistent data store general discharge documents folder, the path to get the simulator can be used NSHomeDirectory () method. Nsuserdefaults saved file in tmp folder.

95. In the process of an object inside: self.name = "object"; and name = "object" What's the difference?

A: self.name = "object": calls setName () method of the object;

name = "object": the object will be directly assigned to the name attribute of the current object.

96. Please briefly describe when to call viewDidLoad and viewDidUnload

A: viewDidLoad is called when the view from the nib file initialization, loadView call when nil in the controller's view. This method is invoked when the programming view, the default view controller will register memory warning notification, when any view view controller does not use the time, viewDidUnload will be called, where implementation will retain the view release, if it retain the IBOutlet view properties here do not release, IBOutlet will be responsible for release.

97. Description of memory partitioning

answer:

1) code area: binary code stored function

2) data areas: application runtime memory and initialize the system, freed by the system when you exit. Store global variables, static variables, constants

3) heap: dynamic application obtained by malloc function or the like and other new operators, programmers need to manually apply and release

4) stack area: the application within a function module, the system automatically released at the end of the function. Storing local variables, function parameters

98. queue and stack What is the difference:

A: Queue and Stack are two different data containers. From "Data Structure" point of view, they are both linear structure, that same relationship between data elements.

A queue is a FIFO data structure that operates at both ends, one end of the operation carried out into the queue, lined up at one end carried out the operation.

Stack is an advanced after the data structure, it can only be operated in the top of the stack, the stack and the stack in the stack operation.

99. HTTP protocol, what is the difference between POST and GET?

answer:

1) .GET method

GET method to submit data insecurity, data placed the request line, client address bar is visible;

The limited size of the data submitted by the GET method

GET method can not be bookmarked

2) .POST method

POST method to submit data security, data placed in the body of the message, the client is not visible

Size of the data submitted by the POST method is no limit

POST method can set bookmarks

100. iOS system architecture

A: iOS system architecture is divided into (core operating system layer theCore OS layer), (core service layer theCore Services layer), (media layer theMedia layer) and (Cocoa interface service layer the Cocoa Touch layer) four levels.

101. The controls are mainly three kinds of response to events

Answer: 1) touch-based events; 2) Based on the value of the event; 3) event-based editing.

102. xib documents constituting which is divided into three icons? They have what function.

A: File's Owner is all nib files for each icon that represents the object to load the nib file from disk;

First Responder is the user interaction is with the current object;

View displays the user interface; complete user interaction; a UIView class or subclass.

103. Brief view control's life cycle.

A: loadView While not directly call the method, such as multi manually create your own views, you should override this method and assign them to the controller tries to view the properties.

viewDidLoad only in its view after the view controller is loaded into memory before the method is called, which is to perform any other initialization entrance.

viewDidUnload When you try to control the release of their methods from memory when called to clear those who may have been trying to control the object was created.

When you try to call viewVillAppear be added to the window and is not visible when the view or the upper layer is removed after the time this view into top-level view of the method for performing such an operation to change the view direction. Be sure to call [super viewWillAppear when implementing this method:

After viewDidAppear view when added to the window to call after removing a layer of the top-level view or the view becomes the top view, for those who need to place code in the rear view display execution. Be sure to call [super viewDidAppear:].

104. The animation, which has several basic types; table view which has several basic styles.

A: There are two basic types of animation: Animation implicit and explicit animations.

105. simple table shows what you need to set the properties UITableView achieve any agreement?

A: The simple table shows the need to set the UITableView delegate and dataSource properties to achieve UITableViewDataSource and UITableViewDelegate agreement.

106. Cocoa Touch which provides several Core Animation transition type?

A: Cocoa Touch provides four Core Animation transition type, namely: cross-fade, push, display and coverage.

107. UIView with CLayer What is the difference?

answer:

1) .UIView system is the basis of iOS interface elements, all the interface elements are inherited from it. Itself entirely by CoreAnimation to achieve. It really drawing part, by a CALayer class to manage. CALayer UIView itself is more like a manager, with access to its mapping and coordinate with the relevant attributes.

2) .UIView there is an important attribute layer, you can return to its main CALayer instance.

3) .UIView of CALayer child View tree structure similar to the UIView to be added to the sub-layer on its layer, to complete some special representation. That CALayer layer can be nested.

4) .UIView layer of the tree within the system, to be maintained triplicate copy. Respectively, logic tree, here is the code that can be manipulated; AnimTree, is an intermediate layer, the system will change the properties at this level, a variety of rendering operation; display the tree, its content is currently being displayed on the screen too content.

5) animation works: on UIView's subLayer (non-primary Layer) attribute changes, the system will automatically generate the animation, the default value duration of the animation seems to be 0.5 seconds.

6) coordinate system:. CALayer UIView coordinate system is more than a anchorPoint property, use CGPoint structure, said range is from 0 to 1, a ratio value. This point is the origin of coordinates various graphical transformations, and it will change the position of the layer's position, its default value is {0.5, 0.5}, that is, in the central layer.

7) rendering: When the update level, change is not immediately displayed on the screen. When all the layers are ready, you can call setNeedsDisplay method to redraw display.

8) conversion: To add a 3D affine transformation or in a layer, you can set the transform property or affineTransform layers respectively.

9) Deformation:. Quartz Core rendering capabilities, so that two-dimensional image can be freely manipulated, like three-dimensional. Images can be rotated to any angle in a three-dimensional coordinate system, scaling, and skewing. CATransform3D a methodology provides some magical effect of the change.

Three core concepts 108. Quatrz 2D drawing functions and what its role briefly.

A: Context: Where is primarily used to describe the pattern writing;

Path: is drawn on the layer contents;

Status: used to hold values, fill and outline, alpha configured value conversion and the like.

109. iPhone OS provides several major audio playback method?

A: SystemSound Services

AVAudioPlayer class

Audio Queue Services

OpenAL

110. Use AVAudioPlayer class called framework which, using the steps?

A: AVFoundation.framework

Step: Configure AVAudioPlayer objects;

Implement delegate method AVAudioPlayer class;

AVAudioPlayer class control object;

Monitor volume level;

Drag the playback progress and play.

111. What are the gestures notification method, write clearly the method name?

answer:

- (Void) touchesBegan: (NSSet *) touchedwithEvent: (UIEvent *) event;

- (Void) touchesMoved: (NSSet *) touched withEvent: (UIEvent *) event;

- (Void) touchesEnded: (NSSet *) touchedwithEvent: (UIEvent *) event;

- (Void) touchesCanceled: (NSSet *) touchedwithEvent: (UIEvent *) event;

112. CFSocket use which of several steps.

A: creating a context Socket; creating Socket; server configuration information to be accessed; package server information; connection to the server;

113. Core Foundation which is provided in several operations Socket way?

A: CFNetwork, CFSocket and BSD Socket.

114. parse XML file, which has several ways?

A: In DOM parse the XML file; SAX to parse the XML file;

115. ios platform how to do data persistence? Coredata and sqlite Have inevitable link? coredata is a relational databases?

A: iOS can have four ways of persistent data: property list (plist), the object archive, SQLite3 and Core Data; core data the way you can make fast graphical data model definition app, while your code is easy to get to it. coredata provides the infrastructure to deal with frequently used functions, such as save, restore, undo and redo, allowing you to continue to create a new task in the app. Using core data, you do not have to install additional database systems, because the core data using the built-in sqlite database. core data layer of your app into the model to a defined set of data objects in memory. coredata tracks change these objects, while the opposite can be varied as desired, for example, the user performs undo command. When the core data in your app data changes to save time, core data will these data archiving, and permanent preservation. mac os x in sqlite library, which is a powerful lightweight relational data engine, it is very easy to embed into applications. You can use multiple platforms, sqlite is a lightweight embedded sql database programming. And core data frame is different, sqlite using procedural, the main API sql to directly manipulate the data table. Core Data is not a relational database, nor is a relational database management system (RDBMS). Although Core Dta support SQLite as a storage type, but it can not use any SQLite database. Core Data used in the process of creating this kind of its own database. Core Data supports one-to-many relationship.

116. tableView reuse mechanism?

A: UITableView by reusing cell to achieve the purpose of saving memory: by specifying a reuse identifier (reuseIdentifier) for each cell, which specifies the types of cells, and when the cell scrolls off the screen, allowing the recovery of cells in order to be reused for different types of cells use a different ID, the simple form, an identifier is enough.
     
         
         
         
  More:      
 
- Android engineers interview questions (Programming)
- Linux LVM space expansion Demo (Linux)
- Swift defined type conversion and type aliases (typealias) (Programming)
- JavaScript is implemented without new keywords constructor (Programming)
- Linux Learning --- disk partition / relational representation + mount (Linux)
- EChart simple and practical control on chart (Programming)
- 5 steps to help you become a good Docker contributors (Linux)
- Comparison of sorting algorithms (Programming)
- To_teach you three strategies to prevent the LAN IP address theft (Linux)
- Linux port scanning (Linux)
- Define and modify strings principle in Python (Programming)
- Improve the efficiency of Linux development tools 5 (Linux)
- sudo command scenario analysis (Linux)
- Python3 multi-thread download codes (Programming)
- How to experience Unity 8 Mir on Ubuntu 16.04 (Linux)
- Monitor log file (listener.log) (Database)
- Oracle JDK installation under Ubuntu Linux (Linux)
- Linux Demo dd IO test (Linux)
- Android Activity launchMode (Programming)
- Hibernate Performance Optimization of reusing SessionFactory (Programming)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.