CosmicRabbitMediaInc
CosmicRabbitMediaInc

Reputation: 1175

UILabel and UIButton not showing

I have a simple display with one UIImageView, two UIButton, and two UILabel. UIImageview appears successfully, but the others don't... and I have no idea why since they are all declared and invoked the same way...

btw, I'm not using interface builder at all, and everything is done programmatically.

following is my interface

@interface selectGender : UIViewController {
IBOutlet UIButton *mButton;
IBOutlet UIButton *fButton;
IBOutlet UILabel *mLabel;
IBOutlet UILabel *fLabel;
IBOutlet UIImageView *logo;
}

and following is my implementation

-(void) start{
logo = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"CosmicRabbit.jpg"]];
logo.frame = CGRectMake(200, 400, 320, 460);


NSLog(@"in start");
mLabel.frame = CGRectMake(80.0, 300.0, 275.0, 275.0);
fLabel.frame = CGRectMake(400.0, 300, 275.0, 275.0);
mButton.frame = CGRectMake(80.0, 500.0, 275.0, 275.0);
fButton.frame = CGRectMake(400.0, 500.0, 275.0, 275.0);
mLabel.textColor=[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
mLabel.text=@"Male";
fLabel.textColor=[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
fLabel.text=@"Female";
[mButton addTarget:self action:@selector(playMale)
    forControlEvents:UIControlEventTouchUpInside];
[fButton addTarget:self action:@selector(playFemale)
    forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:mLabel];
[self.view addSubview:fLabel];
[self.view addSubview:mButton];
[self.view addSubview:fButton];
[self.view addSubview:logo];

}

they're all synthesized in the beginning and released in dealloc.. could anyone please help me out...

btw, this view invoked as a modal view.

Upvotes: 0

Views: 494

Answers (1)

Max
Max

Reputation: 16719

Well, unlike the logo you're not creating that buttons and labels. If you're not using IB, then you have to do that manually. BTW if you're not using IB then you don't need to declare those items as IBOutlet

If 'synthesized' them it only means that complier would create automatic accessor-methods for that ivars, he won't instantiate them.

Upvotes: 2

Related Questions