9.25. The use of IOS slider

发布时间 :2025-10-25 12:23:56 UTC      

The slider is used to select a value from a range of values.

Important attribute

  • Continuous

  • MaximumValue

  • MinimumValue

  • Value

9.25.1. An important method

- (void)setValue:(float)value animated:(BOOL)animated

9.25.2. Add custom methods addSlider and sliderChanged

-(IBAction)sliderChanged:(id)sender{
    NSLog(@"SliderValue %f",mySlider.value);
}
-(void)addSlider{
    mySlider = [[UISlider alloc] initWithFrame:CGRectMake(50, 200, 200, 23)];
    [self.view addSubview:mySlider];
    mySlider.minimumValue = 10.0;
    mySlider.maximumValue = 99.0;
    mySlider.continuous = NO;
    [mySlider addTarget:self action:@selector(sliderChanged:)
    forControlEvents:UIControlEventValueChanged];
}

9.25.3. Modify the viewDidLoad in ViewController.m, as follows

(void)viewDidLoad
{
   [super viewDidLoad];
   [self addSlider];
}

Output

Now when we run the application, we will see the following output

sliderOutput1

When you drag the slider, the effect is as follows:

sliderOutput2

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.