Bonjour,
J'ai créé un projet tout bête.
J'ai créé un Label dans une vue avec pas de texte dedans . En fait je veux juste à l'aide d'un bouton que j'ai créé également faire varier l'intensité du background ( paramètre alpha ( entre 0.0 et 1.0 ) ).
Dans un premier temps pour vérifier si ça marche, j'essaye d'initialiser le Label avec la moitié de son intensité lumineuse. ( alpha=0 min, alpha = 0.5 ( moitié ) , alpha = 1.0 max ).
J'ai appelé Led1 le Label .
J'ai créé une classe UIview que j'ai appelé Led.
Dans Led.h j'ai écrit :
Dans led.m j'ai écrit
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 #import <UIKit/UIKit.h> @interface Led : UIView { IBOutlet UILabel *Led1; } @end
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 #import "Led.h" @implementation Led - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code [Led1 setBackgroundColor: [ UIColor colorWithWhite:0.0 alpha: 0.5]]; // Add the label to the view and release it [ self addSubview:Led1 ]; [ Led1 release ]; } return self; } - (void)drawRect:(CGRect)rect { // Drawing code } - (void)dealloc { [super dealloc]; [ Led1 release ]; } @end
En compilant j'ai le message d'erreur suivant :
Avez-vous une idée de l'erreur que j'ai commis ?[Session started at 2010-01-14 09:05:45 +0100.]
2010-01-14 09:05:50.623 Control Box Cooke[308:20b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<PickerViewController 0x3d1d220> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Led1.'
2010-01-14 09:05:50.624 Control Box Cooke[308:20b] Stack: (
8307803,
2475052603,
8466881,
2787960,
2786501,
25429192,
8210735,
25423743,
25432011,
24117599,
24111163,
24110881,
8355,
23594527,
23632394,
23620488,
23602899,
23630005,
89809,
8092544,
8088648,
23596649,
23633923
)
Merci
Partager