Quite a lot says this ... I have added several goals to my UIButton, I just need to know if I need to remove them before UIButton is released (and dealloc'd), or is it okay to just assume that it will remove itself ?
Thanks!
EDIT: the scenario is: A UIViewController that creates a button and has goals set to self :
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; [btn addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchDown]; [self.view addSubview:btn];
So, now the button belongs to the super-verb and is auto-implemented at the end of the launch cycle. So, if I later remove the button from the view, will it dealloc be fine, or do I also need to do removeTarget:action:forControlEvents: so that the button leaves? I guess the first one, since I hope that the goals are set and not saved, but would it be nice if someone confirms this, please? :)
jowie source share