由于某种原因,我在代码中声明的 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 中。