「FirstViewController」というテーブルビューがあり、テーブル内のいずれかのセルを選択すると、「SecondViewController」にプッシュされます。SecondViewControllerには「randomTitle」という名前のUILabelがあり、FirstViewControllerで選択したセルに基づいて変更する必要があります。
したがって、選択したセルの名前が「ランダム行」の場合、UILabelをそれに変更する必要があります。
私はこれまであまり運がなくてこれを試しました。これはFirstViewControllerに含まれます。
SecondViewController *secondView = [[SecondViewController alloc] init];
secondView.randomTitle.text = @"Test"; // hardcoding it for now
[self.navigationController pushViewController:secondView animated:YES];
ただし、ラベルは変更されません。私は何が欠けていますか?ペン先は正しく接続されています。SecondViewControllerの.hは次のようになります。
@interface SecondViewController : UIViewController
{
UILabel *randomTitle;
}
@property (nonatomic, retain) IBOutlet UILabel *randomTitle;