I have a class MyCell.h / MyCell.m which is a subclass of UITableViewCell. In this class I only have four IBOutlet properties, three labels and one button.
In the implementation I only have synthesize'd these properties.
Then I have a MyCell.xib which is an UITableViewCell and I connected the elements to the MyCell class properties.
In a MyViewController I put an UITableView in it and the table view cells are styled with the one of MyCell.x开发者_开发知识库ib, also they are conntect, the labels, so I can give them the values of my domain objects, like
cell.myTestLabel.text = myDomainObject.sampleText;
The problem is, that I want to connect the button, so that the MyViewController can handle it and I can get the values of the table view row. How can I do this?
Does anyone know?
Best Regards.
You may setup the action handling manually, take a look on the message addTarget:action:forControlEvents: of your button
You can create a handler in MyCell class and relate it with your button through XIB. This is the only solution. You may additionally create a method in your ViewController class, which will be called from your button's event, from MyCell class.
加载中,请稍侯......
精彩评论