I have a UIView class that is loaded in to a UIViewController as a subview, to capture touches and draw them to the screen (a simple drawing app). I want to hide some buttons in the UIViewController when drawing begins. In the UIViewController (DrawingController.m) viewDidLoad method:
//init the draw screen
drawScreen=[[MyLineDrawingView alloc]initWithFrame:self.view.bounds];
[drawScreen setBackgroundColor:[UIColor clearColor]];
[self.view addSubview:drawScreen];
I have a method in the UIViewController (DrawingController.m) that is hiding my colour picker, brush size buttons etc that are present within the UIViewController. The hide method works fine when called from the same class (DrawingController.m). Basically when the -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event method is called within the UIView class (MyLineDrawingView.m) I am hoping to hide the buttons:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
DrawingController *drawController = [[DrawingController alloc] init];
[drawController hideDrawIcons];
}
I've added some logging to the hideDrawIcons method within the UIViewController and it is getting called, but all of my hiding code is not working:
self.undoBtn.hidden = YES;
I suspect this is because I am making a new instance of the UIViewController class with DrawingController *drawController = [[DrawingController alloc] init]; - but I'm not sure how to do things differently?
I have of course exposed the correct method in the DrawingController.h header file, to be able to call it from the UIView class (MyLineDrawingView.m):
-(void)hideDrawIcons;
Hopefully all of that makes sense, thanks in advance!