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

whitedragon101

macrumors 65816
Original poster
Sep 11, 2008
1,336
334
I have a UIButton which I have created in interface builder and I want to access it programatically. However writing the following code and ctrl+dragging in interface builder from the view controller to the button does not display a link to the IBOutlet . It only shows the word view.

Code:
#import <UIKit/UIKit.h>

@interface LoadScreenVC : UIViewController
{
    IBOutlet UIButton *myButton;
} 

@property (nonatomic, retain) IBOutlet UIButton *myButton;

@end
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Have you correctly set the view controller to that class (not just UIViewController). Do you still need to re-import headers in the latest XCode?
 

whitedragon101

macrumors 65816
Original poster
Sep 11, 2008
1,336
334
Have you correctly set the view controller to that class (not just UIViewController). Do you still need to re-import headers in the latest XCode?

Thanks.:)

Didn't think about xcode itself but a clean and build plus restarting xcode seemed to work.

All done
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
And although probably not related to your problem, you don't need to IBOutlet your button twice. In fact, you can get rid of the instance variable, since you have a property for it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.