2015-11-20 29 views

回答

0

就你而言,你可以使用UIButton。因此擁有V圖像就足夠了。 (空正方形圖像的方法也被說明)

需要調用的主要方法是:

//Set the 'V' image for UIControlStateSelected and [UIImage new] for UIControlStateNormal 
- (void)setImage:(UIImage *)image 
     forState:(UIControlState)state; 



//Then, for the surrounding square box you can either use an image, OR better, use the borderWidth and borderColor property of the button's layer to achieve this effect. 

//Image Method 
- (void)setBackgroundImage:(UIImage *)image 
        forState:(UIControlState)state; // Incase you use an image then, use the same image for both UIControlStateSelected and UIControlStateNormal. 

//drawing method 
[checkBoxButton.layer setBorderWidth:<Enter Width in CGFloat>]; 
[checkBoxButton.layer setBorderColor:<Enter Width in CGColor>]; 

注:這裏的關鍵片將通過切換「選擇以保持所述按鈕的選擇狀態'財產。其餘的將自己照顧。

0

這涉及到手動創建一個UICheckbox,繪製一個2D矩形視圖和自定義視圖的檢查。所以你將不得不創建你自己的UI元素。