I have two classes, one view controller an another NSObject class that performs async processes, once its done I want to interrupt the view controller similar to what a button does as IBAction, to update UI. I wanted to keep this functionality in modularized for better use in later stages. Is there a way to do this on Objective-c?
CircleDetectionViewController.h:
#import <UIKit/UIKit.h>
#import "CameraController.h"
@interface CircleDetectionViewController : UIViewController <MyDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *screenPreview;
@end
CircleViewController.mm:
@interface CircleDetectionViewController () <CvVideoCameraDelegate>
@end
@implementation CircleDetectionViewController
CvVideoCamera *camera;
//code
@end
CameraController.h:
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import "CircleDetectionViewController.h"
@protocol MyDelegate <NSObject>
-(void) updateUI;
@end
@interface CameraController : NSObject <MyDelegate>
@property (nonatomic, strong) AVCaptureDevice *inputDevice;
@property (nonatomic, strong) AVCaptureSession *session;
@property (nonatomic, strong) AVCaptureStillImageOutput *photoOutput;
@property (nonatomic, weak) id <MyDelegate> delegate;
@end
CameraController.m:
#import "CameraController.h"
#import "FlashHelper.h"
#import "ImageProcessor.h"
@implementation CameraController
@synthesize delegate;
FlashHelper *Flash;
ImageProcessor *IMGProcessor;
int shootCounter;
int NUMSHOTS = 2;
-(id)init{
//code
}
For some reason the code says "No type or protocol named MyDelegate" Any help would be really appreciated!