我创建一个按钮并将标题设置为“单击此处”。当我按下该按钮时,我想获取该按钮标题并记录它。这是我的代码,我哪里出错了?
-(void)clicketbutton {
UIButton *mybutton = [UIButton buttonWithType:UIButtonTypeCustom];
[mybutton setTitle:@"Click here" forState:UIControlStateNormal];
[mybutton addTarget:self
action:@selector(displayvalue:)forControlEvents:UIControlEventTouchUpInside];
}
-(void)displayvalue:(id)sender {
UIButton *resultebutton= [UIButton buttonWithType:UIButtonTypeCustom];
resultebutton=sender;// pls clear here.. my question here , it it possible or not. if possible how ?
NSLog(@" The buttontitile is %@ ", [resultebutton.Title] // here also.
}