【发布时间】:2012-09-23 00:55:02
【问题描述】:
我无法连接到文件的所有者 XIB。应用类型是通用的。在“参考出口”的文件所有者中,只有“新参考出口”,在“参考出口集合”下,只有“新参考出口集合”。不可能将 UIImageView 的 IBOutlet 连接到 xib。在文件的所有者中没有出现 UIImageView 的 Outlet,尽管我合成了它。这是代码:
在 RootViewController.h 中
#import <UIKit/UIKit.h>
@interface RootViewController : UIViewController <UIGestureRecognizerDelegate>{
}
@property (nonatomic, copy) IBOutlet UIImageView *imageView;
@property (nonatomic, assign)BOOL fromRootViewController;
- (void)handleTap:(UITapGestureRecognizer *)recognizer;
@end
在 RootViewController.m 中
@interface RootViewController ()
@end
@implementation RootViewController
@synthesize imageView;
@synthesize fromRootViewController;
在 RootViewController_iPhone.xib 和 RootViewController_iPad.xib 中不要出现 UIImageView 的 Outlet。
当我运行应用程序时,这是一个错误:
NSInternalInconsistencyException。无法在 Bundle 中加载 NIB:NSBundle
我该怎么办?提前致谢
【问题讨论】:
-
什么类代表文件所有者?
UIViewController类还是RootViewController类?您是否已经在 Interface Builder 中检查过它? -
在界面生成器中编写了 UIViewController 类,现在我用 RootViewController 类修复它并且它可以工作。感谢您的建议。
标签: ios exception xib iboutlet