how to add a instance variable and use it in a custom UIButton
Posted
by thndrkiss
on Stack Overflow
See other posts from Stack Overflow
or by thndrkiss
Published on 2010-04-23T13:35:31Z
Indexed on
2010/04/23
13:43 UTC
Read the original article
Hit count: 510
Hi,
I created a custom UIButton like this
@interface CustomButton : UIButton {
NSString *firstLine;
NSString *secondLine;
}
@property (nonatomic, retain) NSString *firstLine;
@property (nonatomic, retain) NSString *secondLine;
@end
CustomButton* rightButton = [CustomButton buttonWithType:UIButtonTypeDetailDisclosure];
rightButton.secondLine:@"hello";
error message is
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[UIButton setSecondLine:]: unrecognized selector sent to instance 0x43280e0'
What has to be done to fix this up ? how should the instance variable added ?
© Stack Overflow or respective owner