Controlling the alpha of a UIImageView with Slider ..Can' t get it
Posted
by
user1824839
on Stack Overflow
See other posts from Stack Overflow
or by user1824839
Published on 2012-11-14T20:03:10Z
Indexed on
2012/11/14
23:00 UTC
Read the original article
Hit count: 234
first i' d like to say this Forum was really helpfull for me that just started coding some weeks ago ..
I succeed to do a quite nice app for the moment , than, but i m stuck on this :
HOW COULD I CONTROL THE ALPHA OF A UIIMAGEVIEW , WITH A SLIDER EMBEDED IN ANOTHER VIEW ??? ;
Basically i' like to do like the alpha slider of this :
http://www.edumobile.org/iphone/how-to-make-an-app-2/controlling-a-uiviews-properties-for-ipad/
, but for a UIImageView.
I promised i searched for hours , and didnt find how to do it ...
Could someone have some minutes to give me ideas ?? Sorry for my poor english too.
Thanks if you can.
L.
The resume of the link i posted, only focussing on the alpha property would be : ( considering a UIView ( View ) embeded in a ViewController ( ViewController ):
enter code here
----View.h-----
@interface View : UIView
@property ( nonatomic, assign ) CGFloat alpha;
@end
enter code here
----View.m----
@implementation View
@synthesize alpha;
?} @end
enter code here
------ViewController.h-----
import "View.h"
@interface ViewController : UIViewController
@property (nonatomic, strong) IBOutlet View *view;
?- (IBAction)alphaChanged:(UISlider *)sender;
@end
enter code here
-------ViewController.m------
@interface ViewController ()
@end
@implementation ViewController
@synthesize view;
(View *)view {? if (!view) {?
view = [[View alloc] init];? }?
return view;?}
enter code here
(IBAction)redChanged:(UISlider *)sender?
{?
self.circle.alpha = sender.value;? [self.circle setNeedsDisplay];?}
(void)viewDidLoad ?{? [super viewDidLoad];? ? self.circle.alpha = (CGFloat)1;?}
(void)didReceiveMemoryWarning?
{? [super didReceiveMemoryWarning];?
@end
enter code here
© Stack Overflow or respective owner