1 Talk about the understanding of block? and write out a uivew animation using block?
Answer: Block is an anonymous function that can get local variables of other functions, which is not only convenient for development, but also can greatly improve the execution efficiency of the application (multi-core CPU can directly handle the block instruction)
[CPP]View Plaincopyprint?
- [UIView TransitionWithView:self.view
- duration:0.2
- Options:uiviewanimationoptiontransitionflipfromleft
- animations:^{[[Blueviewcontroller view] removefromsuperview]; [Self view] insertSubview:yellowViewController.view atindex:0]; }
- Completion:null];
2 Write the block definition of the above code.
Answer:
typedef void (^animations) (void);
typedef void (^completion) (BOOL finished);
3 try to use + beginanimations:context: And the definition of the block above, 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); function execution part of the operation
Answer: None
Network section
3 Does the project involve network access and what objects do you use to complete network functions?
Answer: ASIHTTPRequest and Nsurlconnection
4 Brief introduction of the following Nsurlconnection class and + SendSynchronousRequest:returningResponse:error: and –initwithrequest:delegate: The difference between two methods?
Answer: Nsurlconnection is mainly used for network access, where + SendSynchronousRequest:returningResponse:error: is synchronous access to data, that is, the current thread is blocked, and waits for the request to return the response, while –initwithrequest:delegate: using an asynchronous load, when it finishes network access, it passes delegate back to the main thread, and its delegate object.
Multithreaded section
iOS face question (iv)-block