I've created a UIView subclass with a UIButton inside with target on tap inside. The selector is implemented inside the UIView subclass and linked by Interface Builder.
But when I run addSubview in parent view controller tapping button will cause
performSelector:withObject:withObject:]: message sent to deallocated instance
(I use ARC) I added some console output in dealloc method and I see that right after viewDidLoad ends with addSubview of the UIView subclass, the sublass is deallocated.
How to prevent that sort of situation? I tried @property(nonatomic, retain), adding instance to some global array... But no luck.
I understand that ARC releses the object as there is no strong reference left but I couldn't force to prevent that situation.
Any help would be appreciated.