1

由于某种原因,我在代码中声明的 IBAction 不在我的文件所有者中。我一直在看这个一个小时,我似乎无法弄清楚。

这可能有一个非常简单的解释。我可能会觉得自己很笨。提前致谢!

下面是我的代码。

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

根视图控制器.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];

}

它们确实出现在第一响应者中,但是当我链接它们时它们不起作用。谢谢!

编辑:我想在不同的 XIB (MainWindow.XIB) 中使用这些操作。我尝试在每个 .h 文件中添加我的操作,但没有一个显示在我的 MainWindow.XIB 中。

4

1 回答 1

0

确保您的RootViewController.h已保存。

打开你的RootViewController.xib并选择 File's Owner。

确保您的 RootViewController 被选为身份选项卡中的类。

在连接选项卡上,您应该能够验证您的 IBAction。

于 2011-02-21T03:51:00.030 回答