Final Exam -- iOS development

1. These lines are from UIView.h.
Identify a class name, a superclass, a protocol it adopts, a category it declares

  @interface UIView : UIResponder<NSCoding> 
  @interface UIView (UIViewAnimation)

2. Here are three method declarations and three method calls.

 -(int) area;
 -(int) area:(int) x :(int) y;
 -(int) area:(int) x height:(int) y;
 int a = [self area:5:6];
 int a = [self area];
 int a = [self area: 4 height:10];

Write the signatures for the three methods.
Match each call to the right method.

What is the return type?

3. A message is sent to an object. If the object does not implement that method what is the next step?

4. Write a typical line of code to create and initialize an object. Let the object be cc and the class CC.

 cc = ??????

5. What happens to myObject when this is executed?

 [myObject retain];

and this?

 [myObject release];

6. UIButton inherits from UIControl,
UIControl inherits from UIView,
UIView inherits from UIResponder,
UIResponder inherits from NSObject

Find one instance method in each of these five classes. (Look in the header (.h) files). Can you find a class method in some of them?

7. UIApplicationDelegate is a protocol. (See UIApplication.h header file),. iOS apps will have a class that adopts this protocol, usually called something like xxxAppDelegate. Which method from the protocol is most commonly implemented in this delegate class? Is the implementation required or optional? What would you use it for?