xcodeでiOS6の開発を始めたところです。しかし、初心者の開発者として、私は問題に直面しました。書籍「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
私は本を読みましたが、なぜこれが起こるのか理解できないようです、plsは助けます。