Q.What are all the newly added frameworks iOS 4.3 to iOS 5.0?
- • Accounts
- • CoreBluetooth
- • CoreImage
- • GLKit
- • GSS
- • NewsstandKit
Q.What is Automatic Reference Counting (ARC)
is a compiler-level feature that simplifies the process of managing the lifetimes of Objective-C objects. Instead of you having to remember when to retain or release an object, ARC evaluates the lifetime requirements of your objects and automatically inserts the appropriate method calls at compile time.
Q. Notification in IOS?
Q.What is the difference between delegates and notifications?
We can use notifications for a variety of reasons. For example, you could broadcast a notification to change how user-interface elements display information based on a certain event elsewhere in the program. Or you could use notifications as a way to ensure that objects in a document save their state before the document window is closed. The general purpose of notifications is to inform other objects of program events so they can respond appropriately.
But objects receiving notifications can react only after the event has occurred. This is a significant difference from delegation. The delegate is given a chance to reject or modify the operation proposed by the delegating object. Observing objects, on the other hand, cannot directly affect an impending operation.
Q.What is posing in IOS?
Objective-C permits a class to entirely replace another class within an application. The replacing class is said to "pose as" the target class. All messages sent to the target class are then instead received by the posing class. There are some restrictions on which classes can pose:
- A class may only pose as one of its direct or indirect superclasses
- The posing class must not define any new instance variables which are absent from the target class (though it may define or override methods).
- No messages must have been sent to the target class prior to the posing.
Posing, similarly to categories, allows globally augmenting existing classes. Posing permits two features absent from categories:
- A posing class can call overridden methods through super, thus incorporating the implementation of the target class.
- A posing class can override methods defined in categories.
An example:
@interface CustomNSApplication : NSApplication
@end
@implementation CustomNSApplication
- (void) setMainMenu: (NSMenu*) menu{
// do something with menu
}
@end
class_poseAs ([CustomNSApplication class], [NSApplication class]);
This intercepts every invocation of setMainMenu to NSApplication.
No comments:
Post a Comment