Scene:
There is a button in the TableView cell, I need to click on this button and then make a view on its view controller change frame, but I click this button, cause the card to die, do not crash, all events expire, I initially thought the thread was stuck, or the event was passed to the view where I needed to change the frame, and I couldn't distribute the event.
Solution:
1. Use block resolution, or other design mode to pass the click message;
2. Use multithreading to solve, the most efficient and fast;
Example:
I'm using block resolution:
declare block in TableView
because I need to pass the value, so with parameters
typedef void (^btnblock) (modeldiscussionlist *);
@property (nonatomic,copy) btnblock block;
In the protocol method for building cell TableView, I add a button click event here and set the button's tag value based on Indexpath.row to get the data
Implement block, and implement value-(void) Outlaftview: (UIButton *) button{ modeldiscussionlist *model = _dataarray[button.tag]; _block (model);}
Call Block when the view controller initializes the TableView
Call block _commentstutableview.block = ^ (modeldiscussionlist *model) { //implement a method to change the view frame in the inside };
That's how I solve this problem.
IOS: Click button to die