createSlider

view.h

#import <UIKit/UIKit.h>


@interface ViewController : UIViewController
@property UISlider *s1,*s2;


@end

view.m

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  
    self.s1=[[UISlider alloc]initWithFrame:CGRectMake(50, 50, 150, 30)];
    self.s1.value=100;
    self.s1.minimumValue=0;
    self.s1.maximumValue=100;
    self.s1.minimumTrackTintColor=[UIColor redColor];
    self.s1.maximumTrackTintColor=[UIColor greenColor];
    [self.view addSubview:self.s1];
    
    self.s2=[[UISlider alloc]initWithFrame:CGRectMake(50, 100, 150, 30)];
    self.s2.thumbTintColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"1.png"]];
//    self.s2.minimumValueImage=[UIImage imageNamed:@"11.png"];
    [self.view addSubview:self.s2];


}

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

@end
Previous
Next Post »