Last time we saw how to set up a subclass and reuse the object. This time we're going to send a message to a method contained in a subclass and the subclass will vary its output based upon the variable contained within that message. I'm keeping things brief, and you'll need to recreate the 'New Project' and 'New File' elements by looking back at last time . This time, however, we'll make the new file a subclass of NSObject instead of UIView. This will mean we don't have "drawRect:" waiting for us to uncomment. So instead here is what your method looks like inside the subclass .m file: - (void)performOperation:(NSString *)operation { if ([(NSString *)operation isEqual:@"can you hear me?"]) { NSLog(@"Yes I can hear you!"); } else { NSLog(@"nope!"); }} And because this is a public method we'll need to add it to the .h file of the subclass with this line of code: - (void)performOperation:(NSString *)oper
Technology tips for writers, editors, designers, illustrators, programmers and publishers, and now Retro Gamers.