I am creating a simple drawing app with a custom view that draws lines on the screen. I am calling a method in my custom view .m file from my viewcontroller file. I’ve got it set up so it autocompletes my method, which means that it knows it exists, but isn’t firing.
In my custom View BezierSigCapView.m
- (void)erase {
path = [UIBezierPath bezierPath];
[pointsArray removeAllObjects];
[self setNeedsDisplay];
NSLog(@"ERASE!");
}
In my View Controller.h file
@property (weak, nonatomic) BezierSigCapView *myView;
In my View Controller.m file
/// in viewDidLoad
BezierSigCapView *theView = [[BezierSigCapView alloc] init];
self.myView = theView;
/// my button code
- (IBAction)ClearButton:(UIBarButtonItem *)sender {
[self.myView erase];
NSLog(@"Should Erase");
}
@hermann pointed me in the right direction. I was creating the view programmatically and in interface builder. I deleted the view that I created programmatically and hooked up an Outlet to the view on interface builder as a property. I also got rid of “theView” which was redundant.