3

UIButton の状態ごとに異なる imageEdgeInsets を設定するにはどうすればよいですか? 例えば

    // For UIControlStateHighlighted state
UIEdgeInsets checkedImageInsets = UIEdgeInsetsMake(-1, -10, -90, -50);
cell.firstElementButton.imageEdgeInsets = checkedImageInsets;
[cell.firstElementButton setImage:[UIImage imageNamed:CHECKBOX_CHECKED_IMAGE] forState:UIControlStateHighlighted];

// For UIControlStateNormal state
UIEdgeInsets uncheckedImageInsets = UIEdgeInsetsMake(-1, -50, -10, -50);
cell.firstElementButton.imageEdgeInsets = uncheckedImageInsets;
[cell.firstElementButton setImage:[UIImage imageNamed:CHECKBOX_UNCHECKED_IMAGE] forState:UIControlStateNormal];

誰もこれについて知っていますか?ありがとう

4

0 に答える 0