UIActionSheet UISlider 的简单使用

//  Created by 妖精的尾巴 on 15-8-17.

//  Copyright (c) 2015 妖精的尾巴. All rights reserved.

//


#import "ViewController.h"


@interface ViewController ()<UIAlertViewDelegate,UIActionSheetDelegate>


@end


@implementation ViewController


- (void)viewDidLoad

{

    [super viewDidLoad];

    /**

     *请在这里调用下面UI控件的方法

     */

    

}

-(void)viewDidAppear:(BOOL)animated

{

  [self createActionSheet];

}

-(void)createActionSheet

{

    UIActionSheet* actSheet=[[UIActionSheet alloc]initWithTitle:@"想念是蓝色的" delegate:self cancelButtonTitle:@"确定" destructiveButtonTitle:@"删除" otherButtonTitles:@"取消", nil];

    [actSheet showInView:self.view];

   }

-(void)createAlter

{

    UIAlertView* alter=[[UIAlertView alloc]initWithTitle:@"爱的国度" message:@"天青色等烟雨,而我在等你,你会在哪里?" delegate:self cancelButtonTitle:@"等你在彼岸" otherButtonTitles:@"灵犀湖畔", nil];

    [alter show];

}

-(void)defineSlider

{

    //自定义slider

    UISlider* slider=[[UISlider alloc]initWithFrame:CGRectMake(50, 80, 250, 20)];

    slider.minimumTrackTintColor=[UIColor greenColor];

    slider.maximumTrackTintColor=[UIColor redColor];

    slider.minimumValue=0;

    slider.maximumValue=100;

    [self.view addSubview:slider];

}


-(void)createSlider

{

    UISlider* slider=[[UISlider alloc]initWithFrame:CGRectMake(100, 100, 200,10)];

    [self.view addSubview:slider];

    slider.minimumValue=0;

    slider.maximumValue=1;

    slider.value=0.1;

    [slider addTarget:self action:@selector(changedValue:) forControlEvents:UIControlEventValueChanged];

}


-(void)changedValue:(UISlider*)slider

{

    NSLog(@"%.2f",slider.value);

}

#pragma mark - UIAlertViewDelegate

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

{

    if (buttonIndex==0) {

        NSLog(@"宛在水中央");

    }

    else{

        NSLog(@"渭水河畔");

    }

}

#pragma mark - UIActionSheetDelegate

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex

{

    if (buttonIndex==0) {

        NSLog(@"我会告诉你这是真的");

    }

    else if (buttonIndex==1)

    {

         NSLog(@"因为你的心是透明的");

    }

    else

    {

        NSLog(@"盛开在花海");

    }


}



你可能感兴趣的:(UIActionSheet UISlider 的简单使用)