views:

44

answers:

3

hi, i have done like

 @interface tabViewController : UIViewController
{
      IBOutlet UIButton* button_first;
  IBOutlet UIButton* button_second;
  IBOutlet UIButton* button_third;
  IBOutlet UIButton*  home;

}

but i could not in file owner those button? what i have to do? any help please? i have set everything correctly (viewcontroller, view)...the day before it was working...i tried in interface builder to reload classes etc...why it happens?

A: 

Did you declare them as properties?

Using: in .h-fle

@property(nonatomic, retain) UIButton *button_first;

And in .m-file:

@synthesize button_first?

?

Gubb
This is not necessary to use them in Interface Builder. This creates getters and setters for use outside of the view controller.
ing0
Oh, of course. Thanks for pointing that out.
Gubb
A: 

have a look at the nib file. may be you have changed the class of that nib file.

Check out whether you see tabViewController in fornt of File's owner.

I am sure you have changed the class so the change is not getting reflected of IBOUTLET in files owner.

and as told by @GUBB its not at all required to set hte property and synthesis of the stuffs..

hAPPY cODING...

Suriya
+2  A: 

You should have this:

VC Header file:

@interface tabViewController : UIViewController
{
    IBOutlet UIButton* button_first;
    IBOutlet UIButton* button_second;
    IBOutlet UIButton* button_third;
    IBOutlet UIButton* home;
}

- (IBAction) ButtonMethod;

VC .m file:

- (IBAction) ButtonMethod
{
    // Code goes here
}

You should now be able to link to the "ButtonMethod" in Interface Builder. Right click the button, click on the circle next to "Touch Up Inside" and link it to "ButtonMethod".

Hope that helps.

EDIT: This images doesn't show the blue line that appears when selecting but shows what you have to press:

alt text

ing0
i have done exactly as u have told....but still i am facing same problem...
Mikhail Naimy
i am seeing other IBoutlet objects
Mikhail Naimy
IBOutlet is very different to IBAction. In the image I posted, 'ButtonMethod' is an IBAction method. You cannot see them any other way. You can of course link a referencing outlet to the button (using IBOutlet) but this won't handle a click.
ing0
The only other thing you might not have setup right is the class in your IB file. Go into 'Inspector' and the far right tab put your class in which I believe is 'tabViewController'.
ing0