Search code examples
xcodeuibuttonibaction

IBActions aren't in File's Owner?


For some reason my IBActions declared in the code aren't in my File's Owner. I've been looking at this for an hour and I can't seem to figure it out.

There's probably a really simple explanation for this. I am probably going to feel dumb. Thanks in advance!

Below is my code.

RootViewController.h

#import <UIKit/UIKit.h>
#import "Sqlite.h"
#import "SecondViewController.h"

@interface RootViewController : UITableViewController {
NSMutableArray *listOfItems;
Sqlite *database;
NSTimer *myTimer;
UITextView *myTextField;

}

- (IBAction)addAlbum;

@property(nonatomic, readonly, retain) UILabel *detailTextLabel;

@end

RootViewController.m

#import "RootViewController.h"
#import "TableViewAppDelegate.h"
#import "DetailViewController.h"

@implementation RootViewController

 // If a user adds a photo album
 - (IBAction)addAlbum {

SecondViewController *screen = [[SecondViewController alloc] initWithNibName:nil bundle:nil];
screen.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:screen animated:YES];
[screen release];

}

They do show up in the First Responder, however when I link them they do not work. Thanks!

Edit: I want to use these actions in a different XIB (MainWindow.XIB). I have tried adding my actions in each of the .h's files but none are showing up in my MainWindow.XIB.


Solution

  • Make sure your RootViewController.h has been saved.

    Open your RootViewController.xib and select File's Owner.

    Make sure your RootViewController is selected as the Class in the identity tab.

    On the connections tab, you should be able to verify your IBActions.