【发布时间】:2008-10-08 21:20:44
【问题描述】:
就目前而言,我似乎遇到了 iPhone SDK 2.1 的问题
能够在 ViewController 和 View 之间建立关系
窗户。就 Cocoa Touch 类而言,我继续前进并添加了一个
UIViewController 子类。我确保目标是
现有项目。之后我添加了一个用户界面 - >查看
西布。在UIViewController 中,我有一些直截了当的代码
从其他地方的示例代码中逐字复制/粘贴:
EditViewController.h:
@interface EditorViewController : UIViewController <UITextFieldDelegate> {
UITextField *field;
}
@property(nonatomic, retain) IBOutlet UITextField *field;
@end
EditViewController.m
#import "EditorViewController.h"
@implementation EditorViewController
- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)dealloc {
[super dealloc];
}
@end
如您所知,它没有多大作用。现在,当我单击我的新 xib 时,
使用EditorViewController 引用类标识,不自动完成
发生,这对我来说意味着它没有这样的意识
EditorViewClass。当我尝试从视图中控制+单击时
文件的所有者,我明白了。
在这个过程中,我有哪些可能的特质? 忽略不允许我将视图输出到控制器?
除了将项目名称作为目标检查之外,我还如何确保我的用户界面视图 XIB 与项目相关联?
【问题讨论】:
标签: iphone cocoa xcode interface-builder