4. Write a setter method to complete @property (nonatomic,retain) nsstring *name, write a setter method for completing @property (nonatomic,copy) NSString * Name
- -(void) SetName: (nsstring*) str
- {
- [Str retain];
- [Name release];
- name = str;
- }
- -(void) SetName: (NSString *) str
- {
- ID t = [str copy];
- [Name release];
- name = t;
- }
6. What are the common object-c data types, and what is the difference between the basic data types of C? such as: Nsinteger and int
OBJECT-C data types have nsstring,nsnumber,nsarray,nsmutablearray,nsdata and so on, these are class, after creation is the object, and C language basic data type int, just a certain byte of memory space, Used to store numeric values; Nsinteger is the basic data type, not a subclass of NSNumber, and certainly not a subclass of NSObject. Nsinteger is the alias of the base data type int or long (Nsinteger's definition typedef long Nsinteger), the difference is that Nsinteger determines whether it is an int or a long based on whether the system is 32-bit or 64-bit.
10. How do I perform a performance test on my iOS device?
profile-> Instruments->time Profiler
11. See the following program, what will the first nslog output? What is the retaincount of STR at this time? A second and a third? Why?
- =======================================================  
- nsmutablearray* ary = [[nsmutablearray array] retain];
- nsstring *str = [nsstring stringwithformat:@ "test"];
- [strretain];
- [ARYADDOBJECT:STR];  
- NSLog (@
- [STRRETAIN];  
- [strrelease];
- [STRRELEASE];  
- NSLog (@
- [ARYREMOVEALLOBJECTS];  
- NSLog (@
- =======================================================  
Str Retaincount creates +1,retain+1, joins the array automatically +1
3
Retain+1,release-1,release-1
2
Array removes all objects, all objects within the array automatically-1
1
What is the method for creating threads in Object C? If you execute code in the main thread, what is the method? What if you want to delay the execution of code and methods?
There are three ways to create a thread: Use Nsthread to create, use GCD dispatch, use a subclass nsoperation, and then add it to Nsoperationqueue; Execute code on the main thread. The method is Performselectoronmainthread, if you want to delay the execution of code can be used PerformSelector:onThread:withObject:waitUntilDone:
2.Give US example of what is delegate methods and what is data source methods of UITableView.
Give an instance of the delegate method and say the UITableView data source method
Answer: Cocoatouch framework uses a large number of delegates, of which uitableviewdelegate is a typical application of the delegation mechanism, is a typical use of the delegate to implement the adapter mode, where the Uitableviewdelegate protocol is the target, TableView is an adapter that implements the Uitableviewdelegate protocol and sets itself to Talbeview delegate object, which is the adapter, in general, the object is Uitableviewcontroller.
UITableView's data source method has-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (nsinteger) Section ;
-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (nsindexpath*) Indexpath;
3.How Many autorelease can create in your application? Is there any limit?
How many Autorelease objects can be created in the app, and is there a limit?
Answer: None
4.If we don ' t create any autorelease pool in US application and then are there any autorelease pool already provided?
If we do not create a memory pool, do we have a memory pool available to us?
Answer: The interface thread maintains its own pool of memory, and the user creates a data thread that needs to create a pool of memory for that thread
5.When you'll create an autorelease pool in your application?
When do I need to create a memory pool in my program?
Answer: A data thread created by the user himself needs to create a memory pool for that thread
6.When retain count increase?
When will memory count increase?
Answer: See iOS face question (i)
7.What is commonly used NSObject class methods?
Which methods of class nsobject are often used?
Answer: NSObject is the base class of Objetive-c, which is composed of NSObject class and a series of protocols.
Class methods Alloc, Class, Description object Methods init, Dealloc, –performselector:withobject:afterdelay: etc. are often used
8.What is convenience constructor?
What is a simple construction method?
Answer: The simple construction method is generally provided by the Cocoatouch framework, such as NSNumber + Numberwithbool: + Numberwithchar: + numberwithdouble: + numberwithfloat: + num Berwithint:
Most of the classes in the foundation have a simple construction method, we can get the system to create good objects by the simple construction method, and do not need to release manually.
9.How to design universal application in Xcode?
How do I design a generic app with Xcode?
Answer: Use the MVC pattern to design the application, where the model layer completes the detach interface, that is, in the model layer, it can be run on any device, in the controller layer, Choose different Viewcontroller objects based on the different features of the iphone and ipad (exclusive Uisplitviewcontroller). In the view layer, it can be designed according to the actual requirements, where the Xib file is designed, it is set to universal.
10.What keyword atomic in Objective C?
What is the atomic keyword when objetive-c?
Answer: atomic,nonatomic See iOS face question (i)
11.What is UIView animations?
What are the animated effects of UIView?
Answer: There are many, such as Uiviewanimationoptioncurveeaseinout Uiviewanimationoptioncurveeasein uiviewanimationoptioncurveeaseout Uiviewanimationoptiontransitionflipfromleft Uiviewanimationoptiontransitionflipfromright Uiviewanimationoptiontransitioncurlupuiviewanimationoptiontransitioncurldown
How to use visible this blog
12.How can store data in IPhone applications?
How do I save data in the iphone app?
Answer: There are several preservation mechanisms:
1. Save on the server via the Web service
2. Save the object in a file by nscoder the curing mechanism
3. Save in the file database via SQLite or CoreData
13.What is CoreData?
What is CoreData?
Answer: CoreData is an apple that provides a data-saving framework based on SQLite
14.What is Nsmanagedobject model?
What is a nsmanagedobject model?
Answer: Nsmanagedobject is a subclass of NSObject, is also an important part of CoreData, it is a generic class, to achieve the core data model layer required by the basic functions, the user can be sub-class Nsmanagedobject, Build your own data model.
15.What is Nsmanagedobjectcontext?
What is Nsmanagedobjectcontext?
Answer: The Nsmanagedobjectcontext object is responsible for the interaction between the application and the database.
16.What is predicate?
What is a predicate?
The answer: predicate is through the nspredicate, is through the given logic condition as the constraint condition, completes the filtering to the data.
predicate = [Nspredicate predicatewithformat:@ "CustomerID = =%d", n];
A = [Customers filteredarrayusingpredicate:predicate];
17.What kind of persistence store we can use with CoreData?
What kinds of persistent storage mechanisms are used with coredata?
Answer: None
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)
- [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.
1 Multi-Threading is what multithreading is a complex concept, the literal meaning is to complete a number of tasks synchronously, improve the use of resources efficiency, from the hardware, operating system, application software from different angles to see, multithreading is given different connotations, for hardware, now on the market most of the CPU is multicore, Multi-core CPU operation multithreading is better, from the operating system point of view, is multi-tasking, now use the mainstream operating system are multi-tasking, can listen to songs, while writing blogs; for applications, multithreading allows applications to respond faster and respond to users ' touch actions while the network is downloading. In the iOS application, the first understanding of multithreading is concurrency, it is the original meaning is to do water, then pick vegetables, and then stir-fry the work, will become boiling water to pick vegetables, and finally to stir-fry. 2 multi-threaded iOS in iOS, is multi-threaded in the cocoa framework, through the cocoa package, we can make it easier to use threads, C + + students may have more understanding of the thread, such as the creation of threads, semaphores, shared variables are aware of, Cocoa framework will be much more convenient, it is a thread encapsulation, some encapsulation, can let us create the object, itself has the thread, that is, the thread of the object of abstraction, thereby reducing our engineering, the robustness of the provider. GCD is the abbreviation for (Grand Central Dispatch), an easy-to-use multi-threaded class library available at the system level, with runtime features to take advantage of multi-core hardware. GCD API interface for C language functions, function parameters, most of the block, about the use of block see here, for us to provide a strong "interface", for the use of GCD see this article nsoperation and Queuensoperation is an abstract class, It encapsulates the thread's detail implementation, and we can manage multithreaded programs by subclasses of the object, plus nsqueue to object-oriented thinking. See here: A nsoperation-based multi-threaded network Access project. Nsthreadnsthread is a control thread execution object, it is not as nsoperation abstract, through which we can easily get a thread, and control it. However, concurrency control between nsthread threads is required to be controlled by ourselves and can be implemented by Nscondition. Seethe use of Nsthread for iOS multithreaded programming other multithreading in the framework of cocoa, notifications, timer, and asynchronous functions are used in multiple threads (to be supplemented). 3 iOS Multi-line Chengchang meeting questions when the project chooses to use GCD, When did you choose Nsoperation? The advantage of using nsoperation in a project is that Nsoperation is a high abstraction of the thread, using it in the project, will make the program structure of the project better, the sub-class nsoperation design idea, is has the object-oriented advantage (multiplexing, encapsulation), so that the implementation is multi-threaded support, The interface is simple and recommended for use in complex projects. The advantage of using GCD in a project is that the GCD itself is very simple and easy to use, saving code for uncomplicated multithreaded operations, and the use of block parameters is more readable and recommended for simple projects.