objective c - Importing view controllers for delegation not working -
i have view controller, firstviewcontroller, subclass, fourthviewcontroller. firstviewcontroller's interface is:
#import "fourthviewcontroller.h" @interface firstviewcontroller : uiviewcontroller <fourthviewcontrollerdelegate>
in fourthviewcontroller's .h, have:
#import "firstviewcontroller.h" @protocol fourthviewcontrollerdelegate -(void) updatelabel; @end @interface fourthviewcontroller : firstviewcontroller @property (weak, nonatomic) id<fourthviewcontrollerdelegate>delegate;
this giving me error message: cannot find interface declaration of 'firstviewcontroller', superclass of 'fourthviewcontroller' i'm not sure why error occuring. advice help.
is keeping delegate in same .h
file controller critical you? pulled separate .h
file , whole thing worked me. this:
//firstviewcontroller.h #import <foundation/foundation.h> #import "fourthviewcontrollerdelegate.h" @interface firstviewcontroller : uiviewcontroller <fourthviewcontrollerdelegate> @end //fourthviewcontrollerdelegate.h #import <foundation/foundation.h> @protocol fourthviewcontrollerdelegate <nsobject> -(void) updatelabel; @end //fourthviewcontroller.h #import <foundation/foundation.h> #import "firstviewcontroller.h" #import "fourthviewcontrollerdelegate.h" @interface fourthviewcontroller : firstviewcontroller @property (weak, nonatomic) id<fourthviewcontrollerdelegate>delegate; @end
Comments
Post a Comment