createSwitch

view.h

#import <UIKit/UIKit.h>


@interface ViewController : UIViewController

@property UISwitch *s1,*s2,*s3;



@end

view.m

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.s1=[[UISwitch alloc]initWithFrame:CGRectMake(50, 50, 0, 0)];
    self.s1.onTintColor=[UIColor redColor];
    self.s1.tintColor=[UIColor yellowColor];
    self.s1.thumbTintColor=[UIColor orangeColor];
    [self.view addSubview:self.s1];
    
    self.s2=[[UISwitch alloc]initWithFrame:CGRectMake(50, 100, 0, 0)];
    
    [self.view addSubview:self.s2];

    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
Previous
Next Post »