zoukankan      html  css  js  c++  java
  • IOSActionSheet、AlertView、Slider、Switch的简单使用

    ActionSheet、AlertView、Slider、Switch的简单使用方法如下:

    - (IBAction)buttonPressed:(id)sender {
        UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure" delegate:self cancelButtonTitle:@"No way" destructiveButtonTitle:@"Yes,I'm sure!" otherButtonTitles:@"Other button", nil];
        [actionSheet showInView:self.view];
        [actionSheet release];
    }

    - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
    {
        if (buttonIndex != [actionSheet cancelButtonIndex]) {
            NSString *msg = nil;
            msg = [[NSString alloc] initWithFormat:@"You can breathe easy, %@ everything went OK.",textFieldName.text];
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Something was done" message:msg delegate:self cancelButtonTitle:@"guo" otherButtonTitles: nil];
            [alert show];
            [alert release];
            [msg release];
        }
    }

    - (IBAction)sliderChanged:(id)sender {              //slider的滑动显示label
        UISlider *slider = (UISlider *)sender;
        int progressAsInt = (int)(slider.value + 0.5f);
        NSString *newText = [[NSString alloc] initWithFormat:@"%d",progressAsInt];
        labelSlider.text = newText;
        [newText release];
    }

    - (IBAction)switchChanged:(id)sender {            //switch选择改变
        UISwitch *whichSwitch = (UISwitch *)sender;
        BOOL setting = whichSwitch.isOn;
        [leftSwitch setOn:setting animated:YES];
        [rightSwitch setOn:setting animated:YES];
    }

  • 相关阅读:
    c#以文件流的形式输出xml(可以解决内存溢出)-XmlTextWriter
    c# 大数据量比较时-方案
    c# 大数据量比较时-方案
    sql中插入多条记录-微软批处理
    sql中插入多条记录-微软批处理
    c#上传图片
    c#上传图片
    sql 数据库优化
    mysql处理旧数据-使用模板以及临时表,不建议直接使用本表!!
    margin-bottom无效问题以及div里内容动态居中样式!
  • 原文地址:https://www.cnblogs.com/tx8899/p/2536423.html
Copyright © 2011-2022 走看看