iOS Interview Questions -Part i
iOS Interview Questions -Part ii
iOS Interview Questions -Part iii
iOS Interview Questions -Part iv
iOS Interview Questions -Part v
iOS Interview Questions -Part vi
iOS Interview Questions -Part vii
iOS Interview Questions -Part viii
iOS Interview Questions -Part ix
iOS Interview Questions -Part ii
iOS Interview Questions -Part iii
iOS Interview Questions -Part iv
iOS Interview Questions -Part v
iOS Interview Questions -Part vi
iOS Interview Questions -Part vii
iOS Interview Questions -Part viii
iOS Interview Questions -Part ix
232.What is dot notation?
Dot notation features introduced into version 2.0 of objective-c. Dot notation involves accessing an instance variable by specifying a class “instance” followed by a “dot” followed in turn by the name of instance variable or property to be accessed.
Dot notation features introduced into version 2.0 of objective-c. Dot notation involves accessing an instance variable by specifying a class “instance” followed by a “dot” followed in turn by the name of instance variable or property to be accessed.
234.Difference between shallow copy and deep copy?
Shallow copy is also known as address copy. In this process you only copy address not actual data while in deep copy you copy data.
Suppose there are two objects A and B. A is pointing to a different array while B is pointing to different array. Now what I will do is following to do shallow copy. Char *A = {‘a’,’b’,’c’}; Char *B = {‘x’,’y’,’z’}; B = A; Now B is pointing is at same location where A pointer is pointing.Both A and B in this case sharing same data. if change is made both will get altered value of data.Advantage is that coping process is very fast and is independent of size of array.
while in deep copy data is also copied. This process is slow but Both A and B have their own copies and changes made to any copy, other will copy will not be affected.
Shallow copy is also known as address copy. In this process you only copy address not actual data while in deep copy you copy data.
Suppose there are two objects A and B. A is pointing to a different array while B is pointing to different array. Now what I will do is following to do shallow copy. Char *A = {‘a’,’b’,’c’}; Char *B = {‘x’,’y’,’z’}; B = A; Now B is pointing is at same location where A pointer is pointing.Both A and B in this case sharing same data. if change is made both will get altered value of data.Advantage is that coping process is very fast and is independent of size of array.
while in deep copy data is also copied. This process is slow but Both A and B have their own copies and changes made to any copy, other will copy will not be affected.
235.Difference between categories and extensions?
Class extensions are similar to categories. The main difference is that with an extension, the compiler will expect you to implement the methods within your main @implementation, whereas with a category you have a separate @implementation block. So you should pretty much only use an extension at the top of your main .m file (the only place you should care about ivars, incidentally) — it’s meant to be just that, an extension.
Class extensions are similar to categories. The main difference is that with an extension, the compiler will expect you to implement the methods within your main @implementation, whereas with a category you have a separate @implementation block. So you should pretty much only use an extension at the top of your main .m file (the only place you should care about ivars, incidentally) — it’s meant to be just that, an extension.
236.What are KVO and KVC?
KVC: Normally instance variables are accessed through properties or accessors but KVC gives another way to access variables in form of strings. In this way your class acts like a dictionary and your property name for example “age” becomes key and value that property holds becomes value for that key. For example, you have employee class with name property.
You access property like
NSString age = emp.age;
setting property value.
emp.age = @”20″;
Now how KVC works is like this
[emp valueForKey:@"age"];
[emp setValue:@"25" forKey:@"age"];
KVO : The mechanism through which objects are notified when there is change in any of property is called KVO.
For example, person object is interested in getting notification when accountBalance property is changed in BankAccount object.To achieve this, Person Object must register as an observer of the BankAccount’s accountBalance property by sending an addObserver:forKeyPath:options:context: message.
KVC: Normally instance variables are accessed through properties or accessors but KVC gives another way to access variables in form of strings. In this way your class acts like a dictionary and your property name for example “age” becomes key and value that property holds becomes value for that key. For example, you have employee class with name property.
You access property like
NSString age = emp.age;
setting property value.
emp.age = @”20″;
Now how KVC works is like this
[emp valueForKey:@"age"];
[emp setValue:@"25" forKey:@"age"];
KVO : The mechanism through which objects are notified when there is change in any of property is called KVO.
For example, person object is interested in getting notification when accountBalance property is changed in BankAccount object.To achieve this, Person Object must register as an observer of the BankAccount’s accountBalance property by sending an addObserver:forKeyPath:options:context: message.
237.Can we use two tableview controllers on one view controller?
Yes, we can use two tableviews on the same view controllers and you can differentiate between two by assigning them tags…or you can also check them by comparing their memory addresses.
Yes, we can use two tableviews on the same view controllers and you can differentiate between two by assigning them tags…or you can also check them by comparing their memory addresses.
238.Swap the two variable values without taking third variable?
int x=10; int y=5; x=x+y; NSLog(@”x==> %d”,x);
y=x-y; NSLog(@”Y Value==> %d”,y);
x=x-y; NSLog(@”x Value==> %d”,x);
int x=10; int y=5; x=x+y; NSLog(@”x==> %d”,x);
y=x-y; NSLog(@”Y Value==> %d”,y);
x=x-y; NSLog(@”x Value==> %d”,x);
239.How it works?
This service is provided by Apple in which rather than pinging server after specific interval for data which is also called pull mechanism, server will send notification to your device that there is new piece of information for you. Request is initiated by server not the device or client.
This service is provided by Apple in which rather than pinging server after specific interval for data which is also called pull mechanism, server will send notification to your device that there is new piece of information for you. Request is initiated by server not the device or client.
Flow of push notification
Your web server sends message (device token + payload) to Apple push notification service (APNS) , then APNS routes this message to device whose device token specified in notification.
Your web server sends message (device token + payload) to Apple push notification service (APNS) , then APNS routes this message to device whose device token specified in notification.
240.What is polymorphism?
This is very famous question and every interviewer asks this. Few people say polymorphism means multiple forms and they start giving example of draw function which is right to some extent but interviewer is looking for more detailed answer.Ability of base class pointer to call function from derived class atruntime is called polymorphism.For example, there is super class human and there are two subclasses software engineer and hardware engineer. Now super class human can hold reference to any of subclass because software engineer is kind of human. Suppose there is speak function in super class and every subclass has also speak function. So at runtime, super class reference is pointing to whatever subclass, speak function will be called of that class. I hope I am able to make you understand.
This is very famous question and every interviewer asks this. Few people say polymorphism means multiple forms and they start giving example of draw function which is right to some extent but interviewer is looking for more detailed answer.Ability of base class pointer to call function from derived class atruntime is called polymorphism.For example, there is super class human and there are two subclasses software engineer and hardware engineer. Now super class human can hold reference to any of subclass because software engineer is kind of human. Suppose there is speak function in super class and every subclass has also speak function. So at runtime, super class reference is pointing to whatever subclass, speak function will be called of that class. I hope I am able to make you understand.
241.What is responder chain?
Suppose you have a hierarchy of views such like there is superview A which have subview B and B has a subview C. Now you touch on inner most view C. The system will send touch event to subview C for handling this event. If C View does not want to handle this event, this event will be passed to its superview B (next responder). If B also does not want to handle this touch event it will pass on to superview A. All the view which can respond to touch events are called responder chain. A view can also pass its events to uiviewcontroller. If view controller also does not want to respond to touch event, it is passed to application object which discards this event.
Suppose you have a hierarchy of views such like there is superview A which have subview B and B has a subview C. Now you touch on inner most view C. The system will send touch event to subview C for handling this event. If C View does not want to handle this event, this event will be passed to its superview B (next responder). If B also does not want to handle this touch event it will pass on to superview A. All the view which can respond to touch events are called responder chain. A view can also pass its events to uiviewcontroller. If view controller also does not want to respond to touch event, it is passed to application object which discards this event.
242.Can we use one tableview with two different datasources? How you will achieve this?
Yes. We can conditionally bind tableviews with two different data sources.
Yes. We can conditionally bind tableviews with two different data sources.
243.What is a protocol?
A protocol is a language feature in objective C which provides multiple inheritance in a single inheritance language. Objective C supports two types of protocols:
A protocol is a language feature in objective C which provides multiple inheritance in a single inheritance language. Objective C supports two types of protocols:
- Ad hoc protocols called informal protocol
- Compiler protocols called formal protocols
- You must create your own autorelease pool as soon as the thread begins executing; otherwise, your application will leak objects
244.Three occasions when you might use your own autorelease pools:
- If you are writing a program that is not based on a UI framework, such as a command-line tool.
- If you write a loop that creates many temporary objects.You may create an autorelease pool inside the loop to dispose of those objects before the next iteration. Using an autorelease pool in the loop helps to reduce the maximum memory footprint of the application.
- If you spawn a secondary thread.
245.InApp purchase product type
Consumable products must be purchased each time the user needs that item. For example, one-time services are commonly implemented as consumable products.
Non-consumable products are purchased only once by a particular user. Once a non-consumable product is purchased, it is provided to all devices associated with that user’s iTunes account. Store Kit provides built-in support to restore non-consumable products on multiple devices.
Auto-renewable subscriptions are delivered to all of a user’s devices in the same way as non-consumable products. However, auto-renewable subscriptions differ in other ways. When you create an auto-renewable subscription in iTunes Connect, you choose the duration of the subscription. The App Store automatically renews the subscription each time its term expires. If the user chooses to not allow the subscription to be renewed, the user’s access to the subscription is revoked after the subscription expires. Your application is responsible for validating whether a subscription is currently active and can also receive an updated receipt for the most recent transaction.
Free subscriptions are a way for you to put free subscription content in Newsstand. Once a user signs up for a free subscription, the content is available on all devices associated with the user’s Apple ID. Free subscriptions do not expire and can only be offered in Newsstand-enabled apps
Consumable products must be purchased each time the user needs that item. For example, one-time services are commonly implemented as consumable products.
Non-consumable products are purchased only once by a particular user. Once a non-consumable product is purchased, it is provided to all devices associated with that user’s iTunes account. Store Kit provides built-in support to restore non-consumable products on multiple devices.
Auto-renewable subscriptions are delivered to all of a user’s devices in the same way as non-consumable products. However, auto-renewable subscriptions differ in other ways. When you create an auto-renewable subscription in iTunes Connect, you choose the duration of the subscription. The App Store automatically renews the subscription each time its term expires. If the user chooses to not allow the subscription to be renewed, the user’s access to the subscription is revoked after the subscription expires. Your application is responsible for validating whether a subscription is currently active and can also receive an updated receipt for the most recent transaction.
Free subscriptions are a way for you to put free subscription content in Newsstand. Once a user signs up for a free subscription, the content is available on all devices associated with the user’s Apple ID. Free subscriptions do not expire and can only be offered in Newsstand-enabled apps
246.the advantages and disadvantages about synchronous versus asynchronous connections.
That’s it, pretty fast and easy, but there are a lot of caveats :
That’s it, pretty fast and easy, but there are a lot of caveats :
- The most important problem is that the thread which called this method will be blocked until the connection finish or timeout, so we surely don’t want to start the connection on the main thread to avoid freezing the UI. That means we need to create a new thread to handle the connection, and all programmers know that threading is hard.
- Cancellation, it’s not possible to cancel a synchronous connection, which is bad because users like to have the choice to cancel an operation if they think it takes too much time to execute.
- Authentication, there is no way to deal with authentication challenges.
- It’s impossible to parse data on the fly.
So let’s put it up straight, avoid using synchronousNSURLConnection, there is absolutely no benefit of using it.
It’s clear that asynchronous connections give us more control :
It’s clear that asynchronous connections give us more control :
- You don’t have to create a new thread for the connection because your main thread will not be blocked.
- You can easily cancel the connection just by calling the cancelmethod.
- If you need authentication just implement the required delegate methods.
- Parsing data on the fly is easy.
So clearly we have a lot of more control with this, and the code is really not difficult.
Even better, we don’t have to handle the creation of a new thread, which is a good thing, because you know, threading is hard.
Well, if you read me until here, you should be convinced to use asynchronous connections, and forget about synchronous ones. They clearly give us more control and possibilities and, in some case can spare us to create new thread.
So I encourage you to move away from synchronous connections, just think of them as evil.
Even better, we don’t have to handle the creation of a new thread, which is a good thing, because you know, threading is hard.
Well, if you read me until here, you should be convinced to use asynchronous connections, and forget about synchronous ones. They clearly give us more control and possibilities and, in some case can spare us to create new thread.
So I encourage you to move away from synchronous connections, just think of them as evil.
247.What is the navigation controller?
Navigation controller contains the stack of controllers every navigation controller must be having root view controller by default these controllers contain 2 method
(a) push view
(b) pop view
By default navigation controller contain “table view”.
Navigation controller contains the stack of controllers every navigation controller must be having root view controller by default these controllers contain 2 method
(a) push view
(b) pop view
By default navigation controller contain “table view”.
248.Cocoa.
Cocoa is an application environment for both the Mac OS X operating system and iOS. It consists of a suite of object-oriented software libraries, a runtime system, and an integrated development environment. Carbon is an alternative environment in Mac OS X, but it is a compatibility framework with procedural programmatic interfaces intended to support existing Mac OS X code bases.
Cocoa is an application environment for both the Mac OS X operating system and iOS. It consists of a suite of object-oriented software libraries, a runtime system, and an integrated development environment. Carbon is an alternative environment in Mac OS X, but it is a compatibility framework with procedural programmatic interfaces intended to support existing Mac OS X code bases.
249.Frameworks that make Cocoa.
- Appkit (Application Kit)
- Foundation
250.Objective-C.
Objective-C is a very dynamic language. Its dynamism frees a program from compile-time and link-time constraints and shifts much of the responsibility for symbol resolution to runtime, when the user is in control. Objective-C is more dynamic than other programming languages because its dynamism springs from three sources:
Dynamic typing—determining the class of an object at runtime
Dynamic binding—determining the method to invoke at runtime
Dynamic loading—adding new modules to a program at runtime
Objective-C is a very dynamic language. Its dynamism frees a program from compile-time and link-time constraints and shifts much of the responsibility for symbol resolution to runtime, when the user is in control. Objective-C is more dynamic than other programming languages because its dynamism springs from three sources:
Dynamic typing—determining the class of an object at runtime
Dynamic binding—determining the method to invoke at runtime
Dynamic loading—adding new modules to a program at runtime
251.Objective-C vs C/C++.
The Objective-C class allows a method and a variable with the exact same name. In C++, they must be different.
The Objective-C class allows a method and a variable with the exact same name. In C++, they must be different.
- Objective-C does not have a constructor or destructor. Instead it has init and dealloc methods, which must be called explicitly.
- Objective-C uses + and – to differentiate between factory and instance methods, C++ uses static to specify a factory method.
- Multiple inheritance is not allowed in Obj-C, however we can use protocol to some extent.
- Obj-C has runtime binding leading to dynamic linking.
- Obj-C has got categories.
- Objective-C has a work-around for method overloading, but none for operator overloading.
- Objective-C also does not allow stack based objects. Each object must be a pointer to a block of memory.
- In Objective-C the message overloading is faked by naming the parameters. C++ actually does the same thing but the compiler does the name mangling for us. In Objective-C, we have to mangle the names manually.
- One of C++’s advantages and disadvantages is automatic type coercion.
- Another feature C++ has that is missing in Objective-C is references. Because pointers can be used wherever a reference is used, there isn’t much need for references in general.
- Templates are another feature that C++ has that Objective-C doesn’t. Templates are needed because C++ has strong typing and static binding that prevent generic classes, such as List and Array.
252.Appilcation Kit/App kit.
The Application Kit is a framework containing all the objects you need to implement your graphical, event-driven user interface: windows, panels, buttons, menus, scrollers, and text fields. The Application Kit handles all the details for you as it efficiently draws on the screen, communicates with hardware devices and screen buffers, clears areas of the screen before drawing, and clips views.
You also have the choice at which level you use the Application Kit:
The Application Kit is a framework containing all the objects you need to implement your graphical, event-driven user interface: windows, panels, buttons, menus, scrollers, and text fields. The Application Kit handles all the details for you as it efficiently draws on the screen, communicates with hardware devices and screen buffers, clears areas of the screen before drawing, and clips views.
You also have the choice at which level you use the Application Kit:
- Use Interface Builder to create connections from user interface objects to your application objects.
- Control the user interface programmatically, which requires more familiarity with AppKit classes and protocols.
- Implement your own objects by subclassing NSView or other classes.
253.Foundation Kit.
The Foundation framework defines a base layer of Objective-C classes. In addition to providing a set of useful primitive object classes, it introduces several paradigms that define functionality not covered by the Objective-C language. The Foundation framework is designed with these goals in mind:
The Foundation framework defines a base layer of Objective-C classes. In addition to providing a set of useful primitive object classes, it introduces several paradigms that define functionality not covered by the Objective-C language. The Foundation framework is designed with these goals in mind:
- Provide a small set of basic utility classes.
- Make software development easier by introducing consistent conventions for things such as deallocation.
- Support Unicode strings, object persistence, and object distribution.
- Provide a level of OS independence, to enhance portability.
254.Dynamic and Static Typing.
Static typed languages are those in which type checking is done at compile-time, whereas dynamic typed languages are those in which type checking is done at run-time.
Objective-C is a dynamically-typed language, meaning that you don’t have to tell the compiler what type of object you’re working with at compile time. Declaring a type for a varible is merely a promise which can be broken at runtime if the code leaves room for such a thing. You can declare your variables as type id, which is suitable for any Objective-C object.
Static typed languages are those in which type checking is done at compile-time, whereas dynamic typed languages are those in which type checking is done at run-time.
Objective-C is a dynamically-typed language, meaning that you don’t have to tell the compiler what type of object you’re working with at compile time. Declaring a type for a varible is merely a promise which can be broken at runtime if the code leaves room for such a thing. You can declare your variables as type id, which is suitable for any Objective-C object.
255.Selectors
In Objective-C, selector has two meanings. It can be used to refer simply to the name of a method when it’s used in a source-code message to an object. It also, though, refers to the unique identifier that replaces the name when the source code is compiled. Compiled selectors are of type SEL. All methods with the same name have the same selector. You can use a selector to invoke a method on an object—this provides the basis for the implementation of the target-action design pattern in Cocoa.
[friend performSelector:@selector(gossipAbout:) withObject:aNeighbor];
is equivalent to:
[friend gossipAbout:aNeighbor];
In Objective-C, selector has two meanings. It can be used to refer simply to the name of a method when it’s used in a source-code message to an object. It also, though, refers to the unique identifier that replaces the name when the source code is compiled. Compiled selectors are of type SEL. All methods with the same name have the same selector. You can use a selector to invoke a method on an object—this provides the basis for the implementation of the target-action design pattern in Cocoa.
[friend performSelector:@selector(gossipAbout:) withObject:aNeighbor];
is equivalent to:
[friend gossipAbout:aNeighbor];
256.Class Introspection
- Determine whether an objective-C object is an instance of a class
[obj isMemberOfClass:someClass];
- Determine whether an objective-C object is an instance of a class or its descendants
[obj isKindOfClass:someClass];
- The version of a class
[MyString version]
- Find the class of an Objective-C object
Class c = [obj1 class]; Class c = [NSString class];
- Verify 2 Objective-C objects are of the same class
[obj1 class] == [obj2 class]
257.Proxy
As long as there aren’t any extra instance variables, any subclass can proxy itself as its superclass with a single call. Each class that inherits from the superclass, no matter where it comes from, will now inherit from the proxied subclass. Calling a method in the superclass will actually call the method in the subclass. For libraries where many objects inherit from a base class, proxying the superclass can be all that is needed.
As long as there aren’t any extra instance variables, any subclass can proxy itself as its superclass with a single call. Each class that inherits from the superclass, no matter where it comes from, will now inherit from the proxied subclass. Calling a method in the superclass will actually call the method in the subclass. For libraries where many objects inherit from a base class, proxying the superclass can be all that is needed.
258.Why category is better than inheritance?
If category is used, you can use same class, no need to remember a new class-name. Category created on a base class is available on sub classes.
If category is used, you can use same class, no need to remember a new class-name. Category created on a base class is available on sub classes.
259.Formal Protocols
Formal Protocols allow us to define the interface for a set of methods, but implementation is not done. Formal Protocols are useful when you are using DistributedObjects, because they allow you to define a protocol for communication between objects, so that the DO system doesn’t have to constantly check whether or not a certain method is implemented by the distant object.
Formal Protocols allow us to define the interface for a set of methods, but implementation is not done. Formal Protocols are useful when you are using DistributedObjects, because they allow you to define a protocol for communication between objects, so that the DO system doesn’t have to constantly check whether or not a certain method is implemented by the distant object.
260.Formal vs informal protocol.
In addition to formal protocols, you can also define an informal protocol by grouping the methods in a category declaration:
@interface NSObject (MyProtocol)
//someMethod();
@end
Informal protocols are typically declared as categories of the NSObject class, because that broadly associates the method names with any class that inherits from NSObject. Because all classes inherit from the root class, the methods aren’t restricted to any part of the inheritance hierarchy. (It is also possible to declare an informal protocol as a category of another class to limit it to a certain branch of the inheritance hierarchy, but there is little reason to do so.)
When used to declare a protocol, a category interface doesn’t have a corresponding implementation. Instead, classes that implement the protocol declare the methods again in their own interface files and define them along with other methods in their implementation files.
An informal protocol bends the rules of category declarations to list a group of methods but not associate them with any particular class or implementation.
Being informal, protocols declared in categories don’t receive much language support. There’s no type checking at compile time nor a check at runtime to see whether an object conforms to the protocol. To get these benefits, you must use a formal protocol. An informal protocol may be useful when all the methods are optional, such as for a delegate, but (in Mac OS X v10.5 and later) it is typically better to use a formal protocol with optional methods.
In addition to formal protocols, you can also define an informal protocol by grouping the methods in a category declaration:
@interface NSObject (MyProtocol)
//someMethod();
@end
Informal protocols are typically declared as categories of the NSObject class, because that broadly associates the method names with any class that inherits from NSObject. Because all classes inherit from the root class, the methods aren’t restricted to any part of the inheritance hierarchy. (It is also possible to declare an informal protocol as a category of another class to limit it to a certain branch of the inheritance hierarchy, but there is little reason to do so.)
When used to declare a protocol, a category interface doesn’t have a corresponding implementation. Instead, classes that implement the protocol declare the methods again in their own interface files and define them along with other methods in their implementation files.
An informal protocol bends the rules of category declarations to list a group of methods but not associate them with any particular class or implementation.
Being informal, protocols declared in categories don’t receive much language support. There’s no type checking at compile time nor a check at runtime to see whether an object conforms to the protocol. To get these benefits, you must use a formal protocol. An informal protocol may be useful when all the methods are optional, such as for a delegate, but (in Mac OS X v10.5 and later) it is typically better to use a formal protocol with optional methods.
261.Optional vs required
Protocol methods can be marked as optional using the @optional keyword. Corresponding to the @optional modal keyword, there is a @required keyword to formally denote the semantics of the default behavior. You can use @optional and @required to partition your protocol into sections as you see fit. If you do not specify any keyword, the default is @required.
@protocol MyProtocol
@optional
-(void) optionalMethod;
@required
-(void) requiredMethod;
@end
Protocol methods can be marked as optional using the @optional keyword. Corresponding to the @optional modal keyword, there is a @required keyword to formally denote the semantics of the default behavior. You can use @optional and @required to partition your protocol into sections as you see fit. If you do not specify any keyword, the default is @required.
@protocol MyProtocol
@optional
-(void) optionalMethod;
@required
-(void) requiredMethod;
@end
262.Memory Management
If you alloc, retain, or copy/mutablecopy it, it’s your job to release it. Otherwise it isn’t.
If you alloc, retain, or copy/mutablecopy it, it’s your job to release it. Otherwise it isn’t.
263.Copy vs assign vs retain
- Assign is for primitive values like BOOL, NSInteger or double. For objects use retain or copy, depending on if you want to keep a reference to the original object or make a copy of it.
- assign: In your setter method for the property, there is a simple assignment of your instance variable to the new value, eg:
(void)setString:(NSString*)newString{
string = newString;
}
This can cause problems since Objective-C objects use reference counting, and therefore by not retaining the object, there is a chance that the string could be deallocated whilst you are still using it.
string = newString;
}
This can cause problems since Objective-C objects use reference counting, and therefore by not retaining the object, there is a chance that the string could be deallocated whilst you are still using it.
- retain: this retainsthe new value in your setter method. For example:
This is safer, since you explicitly state that you want to maintain a reference of the object, and you must release it before it will be deallocated.
(void)setString:(NSString*)newString{
[newString retain];
[string release];
string = newString;
}
(void)setString:(NSString*)newString{
[newString retain];
[string release];
string = newString;
}
- copy: this makes a copy of the string in your setter method:
This is often used with strings, since making a copy of the original object ensures that it is not changed whilst you are using it.
(void)setString:(NSString*)newString{
if(string!=newString){
[string release];
string = [newString copy];
}
}
(void)setString:(NSString*)newString{
if(string!=newString){
[string release];
string = [newString copy];
}
}
264.alloc vs new
“alloc” creates a new memory location but doesn’t initializes it as compared to “new”.
“alloc” creates a new memory location but doesn’t initializes it as compared to “new”.
FabGreenTechnologies-Madivala
FabGreenTech.com
FabGreenTech.com
It feels awesome to read such informative and unique articles on your websites. Accounts-P
ReplyDelete