Solved

simple button

Posted on 2012-12-30
1
464 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
ID: 38731936
HI sniger

give it a background color.

button.backgroundColor = [UIColor redColor];

Open in new window

0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

The Basics of Storyboard Storyboards were first introduced to developers in the release of iOS 5. They save the developer the trouble of designing each screen’s interface in a different file. The storyboard allows you to see the conceptual mockup o…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

803 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