Solved

simple button

Posted on 2012-12-30
1
463 Views
Last Modified: 2012-12-30
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 ()

@end

@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.
}



    

@end

Open in new window


.h file:


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

@interface xyzViewController : UIViewController

@end
 

Open in new window



I am testing it on IO6 iPhone/ipad simulator
0
Comment
Question by:sniger
1 Comment
 
LVL 19

Accepted Solution

by:
darbid73 earned 500 total points
Comment Utility
HI sniger

give it a background color.

button.backgroundColor = [UIColor redColor];

Open in new window

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I recently went through the process of creating an installable image of an iPhone mobile app (an .ipa file) that beta testers could load onto their test devices. The process involved quite a few steps, but both Appcelerator and Diawi.org had decent …
When Apple released Swift last year, the aim was to introduce a new programming language for Cocoa and Cocoa Touch that was fast, easy and effective, like the name connotes. Apple succeeded. Swift is designed to couple with Objective-C program…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now