In a programming exercise, I am to change the a class's superclass name. But, if I go into the interface file and change the superclass name from NSObject to a different name, Xcode gives me an error. At the time when the .h and .m files were created, you had to designate the class name these files would be a subclass to. Apparently, this is set into stone. I cannot find anything to override or change the superclass designation from any of the menu bar selections. I know you can move items and variables up and down the class hierarchy but I want to move two files. So far the only solution I have found is to delete both files and create them again with a new subclass designation. Surely, there is more flexibility in this IDE; because during a project development, changes constantly occur.
The file creating procedure was to select File, New File, Cocoa Touch under iOS, select Objective-C Class. Another window pops up and you enter your class name and then select which class this new class is a subclass to.
Example: Rectangle.h
@interface Rectangle: NSObject - orginally designated when Rectangle.h and Rectangle.m files were created.
@interface Rectangle: GraphicObject - typed over the above class to this, but Xcode displays an error because when the Rectangle.h and Rectangle.m files were created, Rectangle was set to be the subclass of NSObject.
0 comments:
Post a Comment