顏色範例程式碼 #import "ViewController.h" @interface ViewController () @property ( weak , nonatomic ) IBOutlet UISlider *red; //Slider的IBoutlet @property ( weak , nonatomic ) IBOutlet UISlider *blue; //Slider的IBoutlet @property ( weak , nonatomic ) IBOutlet UISlider *green; //Slider的IBoutlet @property ( weak , nonatomic ) IBOutlet UILabel *redLabel; //Label的IBoutlet @property ( weak , nonatomic ) IBOutlet UILabel *blueLabel; //Label的IBoutlet @property ( weak , nonatomic ) IBOutlet UILabel *greenLabel; //Label的IBoutlet @end @implementation ViewController - ( IBAction )colorChange:(UISlider *)sender { float red= self .red .value ; float blue= self .blue .value ; float green= self .green .value ; _redLabel .text =[ NSString stringWithFormat:@ "Red:%.0f" ,red]; _blueLabel .text =[ NSString stringWithFormat:@ "Blue:%.0f" ,blue]; _greenLabel .text =[ NSString stringWithFormat:@ "Green:%.0f...