Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

simple button

Posted on 2012-12-30
1
Medium Priority
?
470 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 20

Accepted Solution

by:
darbid73 earned 2000 total points
ID: 38731936
HI sniger

give it a background color.

button.backgroundColor = [UIColor redColor];

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What's a UDID? If you're involved in developing, testing, or even reviewing an iOS application that's in beta, then at some point you may need to know the UDID for any iOS devices that you'll be testing on. What's the UDID? It stands for Unique Dev…
The release of the iPhone 6 and the iPhone 6 Plus was extremely successful for Apple. However when iOS 8.1 was introduced, many iPhone users complained of quick battery drainage. Without even knowing, you may be unnecessarily using up your battery p…
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

971 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