我剛開始爲xcode上的ios 6開發。 但是作爲新手開發者,我遇到了一個問題。 按照第3章「開始ios5開發:探索ios sdk」一書中的指導,「按鈕有趣」示例。xcode上的未聲明標識符
我遇到了問題,我已經在.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
我按照這本書,但似乎無法理解爲什麼發生這種情況,請幫幫我。
您遇到的具體問題是什麼?編譯器問題或運行時錯誤? – tomasmcguinness