Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

massive.boisson

macrumors newbie
Original poster
Dec 27, 2008
1
0
Hi,

I've created NIB file for one ViewController on my Navigation Controller. It opens up and shows empty white view. I want to show UIButtons on it programatically.
I overwrite viewDidLoad method, and can see it gets called. I create a button, but am not able to attach that button to view.

I've tried numerous ways, but this is one of them:
Code:
	UIButton *myButton = [self makeMyButton];
	[button setCenter:CGPointMake(160.0f, 200.0f)];	
	self.view = myButton;
	[button release];

Any help really appreciated.

Thanks in advance

--MB
 

ghayenga

macrumors regular
Jun 18, 2008
190
0
At least I got the impression he was trying to add the button to the view and not the navigation bar.
 

l.sanjeevrao

macrumors newbie
Oct 17, 2008
11
0
Adding uibtton to nib file programmetically

I think it does not possible to add the uibutton for nib file programmatically.
Do one thing, just create the view programmetically and add the button to it instead of using nib file.
 

natanavra

macrumors newbie
Dec 26, 2008
11
0
Why can't you use the nib itself...?
anyways you can use...
[self.view addSubview:mybutton];
[mybutton release];

umm... I think it's possible to manipulate a nib programatically, you hook up the nib to a UIView subclass and in it.. you initialize a button programatically in that View... in the viewDidLoad Method.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.