以下是我的实施代码: -
[self.tncCheckBoxLabel setTitle:@"Accept Terms and Conditions" forState:UIControlStateNormal];
[self.tncCheckBoxLabel setImage:[UIImage imageNamed:@"Unchecked Checkbox Filled-50.png"] forState:UIControlStateNormal];
[self.tncCheckBoxLabel setImage:[UIImage imageNamed:@"Checked Checkbox Filled-50.png"] forState:UIControlStateSelected];
//onClick method
- (IBAction)tncCheckBoxPressed:(id)sender {
//self.tncCheckBoxLabel.selected = !self.tncCheckBoxLabel.selected;
self.tncCheckBoxLabel.selected = !self.tncCheckBoxLabel.selected;
}
初步观点:
点击按钮后的视图:
初始视图很好,但点击按钮后,图像会自动包裹在文本上。
我想在左侧显示看起来像初始视图的选中图像。