user804817
user804817

Reputation:

UIButton with the tag property

I am getting my UIButton with its tag bay name by using.

UIButton *mybutton=[[UIButton alloc]init];

mybutton=(UIButton*)[cell viewWithTag:5];

and with UIButton* mybutton=(UIButton*)[cell viewWithTag:5];

This is fine.but when i change it's text(with tag button) by using

[mybutton setTitle:@"hello" forState:UIControlStateNormal];

App Crashes with this error

[UITableViewCell setTitle:forState:]: unrecognized selector sent to instance 0x4b6f540'

* Call stack at first throw:

Any Solution??

Thanks in advance

Upvotes: 1

Views: 1085

Answers (1)

Use with your contentView

    mybutton=(UIButton*)[cell.contentView viewWithTag:5];

Upvotes: 2

Related Questions