各セルの前に画像ボタンがUITableView
あり、その座標を調整したいUIButton
。関連するコードcellForRow
は次のとおりです。
UIImage *image = [UIImage imageNamed "unchecked.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
CGRect frame1 = CGRectMake(0.0,0.0, image.size.width, image.size.height);** //changing the coordinates here doesn't have any effect on the position of the image button.
button.frame = frame1; // match the button's size with the image size
[button setBackgroundImage:image forState:UIControlStateNormal]; // set the button's target to this table view controller so we can interpret touch events and map that to a NSIndexSet [button addTarget :self action: @selector(checkButtonTapped:event) forControlEvents:UIControlEventTouchUpInside];