Я решил это по-другому. Подкласс UIButton и добавил все свойства, которые мне нужны. Вот как выглядит класс:
@interface RecentSalePropertyDetailsButton : UIButton {
Property* property;
}
@property (nonatomic, retain) Property* property;
@end
@implementation RecentSalePropertyDetailsButton
@synthesize property;
- (id) initWithPropertyAs:(Property*)aProperty{
[super init];
self.property = aProperty;
return self;
}
@end
Затем, далее, я делаю следующее:
// allocate the details button's action
RecentSalePropertyDetailsButton* button = (RecentSalePropertyDetailsButton *)[myView viewWithTag:15];
button.property = property;
[button addTarget:self action:@selector(showRecentSalesPropertyDetails:) forControlEvents:UIControlEventTouchDown];