158,开关按钮,滑块按钮和分段按钮

来源:互联网 发布:软件组合属于系统软件 编辑:程序博客网 时间:2024/05/16 23:48


#import "ViewController.h"


@interface ViewController ()

@property (weak, nonatomic) IBOutletUISwitch *switchBtn1;

@property (weak, nonatomic) IBOutletUISwitch *switchBtn2;

@property (weak, nonatomic) IBOutletUILabel *silderValue;



@end


@implementation ViewController


- (IBAction)switchValueChanged:(UISwitch *) switchBtn{

        BOOL set =switchBtn.isOn;

        [self.switchBtn1setOn:set animated:YES];

        [self.switchBtn2setOn:set animated:YES];

}



- (IBAction)changeSilderValue:(UISlider *)slider {

    self.silderValue.text = [NSStringstringWithFormat:@"%lf",slider.value];

}


- (IBAction)changeSegment:(UISegmentedControl *)segment {

    NSLog(@"segment.index = %lu",segment.selectedSegmentIndex);

}

@end



0 0