【发布时间】:2012-09-25 16:01:56
【问题描述】:
我刚开始在 xcode 上为 ios 6 进行开发。 但是作为一个新手开发者,我遇到了一个问题。 按照“开始 ios5 开发:探索 ios sdk”一书第 3 章中的指南,“按钮乐趣”示例。
我在 .h 代码中声明的标识符“statusText”有问题。
到目前为止,这是我的代码,我们将不胜感激。提前谢谢你。
我的 BIDViewController.h 是这样的
#import <UIKit/UIKit.h>
@interface BIDViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *
statusText;
- (IBAction)buttonPress:(UIButton *)sender;
@end`
而我的 BIDViewController.m 就是这样
#import "BIDViewController.h"
@interface BIDViewController ()
@end
@implementation BIDViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)buttonPress:(UIButton *)sender {
NSString *title = [sender titleForState:<#(UIControlState)#>];
statusText.text = [NSString stringWithFormat:@"%@ button pressed.", title];
}
@end
我已经按照这本书,但似乎无法理解为什么会发生这种情况,请帮助。
【问题讨论】:
-
您遇到的具体问题是什么?编译器问题或运行时错误?
标签: iphone xcode ios5 ios6 undeclared-identifier