ビューコントローラーとクラスがあります(ストーリーボードを使用しています)。UILabel
クラスから (View Controller 内の) a のテキストを変更するにはどうすればよい ですか? 私はこれを試しましたが、役に立ちませんでした:
ViewController *mainView = [[ViewController alloc] init];
[mainView view];
[mainView.progressBar setProgress:integer animated:YES];
NSLog(@"Updated Progress Bar");
NSString *progressLabelText = [NSString stringWithFormat:@"%@ out of %i followers", userString, [self.followers count]];
[mainView.progressLabel setText:progressLabelText];
NSLog(@"Updated Progress Label Text: %@", progressLabelText);
このコードを使用しても、テキストは変更されません。代わりに何をすべきですか?
編集: ViewController の .h ファイルのプログレスバーとラベルは次のようになります。
@property (nonatomic, strong) IBOutlet UIProgressView *progressBar;
@property (nonatomic, strong) IBOutlet UILabel *progressLabel;
これらは Interface Builder で完全にリンクされています。