How to add pointer to an NSObject custom subclass to an NSMutableArray?
问题 For the following code snippet from ViewController.m: - (IBAction)buttonAction:(id)sender { CustomButton *button = (CustomButton *)sender; button.associatedObject = [self.sourceOfObjects.objectArray lastObject]; [self.foo.arrayOfObjects addObject:button.associatedObject]; // this does not work? } • CustomButton is subclass of UIButton and has @property (nonatomic, strong) associatedObject that is a pointer to an object of type NSObject. • sourceOfObjects is a @property (nonatomic, strong) of