//
// ViewController.h
// imageViewSliderAlpha
//
// Created by Weerachai on 12/5/55 BE.
// Copyright (c) 2555 Weerachai. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
{
IBOutlet UIImageView *imgView;
IBOutlet UISlider *sliderObj;
}
- (IBAction)sliderChanged:(id)sender;
@end
ViewController.m
//
// ViewController.m
// imageViewSliderAlpha
//
// Created by Weerachai on 12/5/55 BE.
// Copyright (c) 2555 Weerachai. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIImage* img = [UIImage imageNamed:@"girl.jpg"];
[imgView setImage:img];
}
- (IBAction)sliderChanged:(id)sender {
float value = [sliderObj value];
[imgView setAlpha:value];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)dealloc {
[imgView release];
[sliderObj release];
[super dealloc];
}
@end