simple button

Hi, I am trying to add a simple button programatically and it is not showing up.
What is wrong with it ?

#import "xyzViewController.h"

@interface xyzViewController ()


@implementation xyzViewController

- (void)viewDidLoad
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    CGRect buttonFrame = CGRectMake(60, 60, 200,80);
    UIButton *button = [[UIButton alloc] initWithFrame:buttonFrame];
    button.layer.borderColor = [UIColor redColor].CGColor;
    [self.view addSubview:button];

- (void)didReceiveMemoryWarning
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.



Open in new window

.h file:

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>

@interface xyzViewController : UIViewController


Open in new window

I am testing it on IO6 iPhone/ipad simulator
Who is Participating?
darbid73Connect With a Mentor Commented:
HI sniger

give it a background color.

button.backgroundColor = [UIColor redColor];

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.