0

ビューがロードされると、テーブルビューは最初の行を選択し、didselectatrow メソッドを起動して何かを行います。最初の行を選択する方法はわかったのですが、同時に didselectatrow メソッドを起動しません。その方法を教えてください。

4

1 に答える 1

5

でメソッドを手動で呼び出すことができますviewDidLoad

- (void)viewDidLoad {
    [super viewDidLoad];

    // select the first row
    NSIndexPath *firstRowPath = [NSIndexPath indexPathForRow:0 inSection:0];
    [self.tableView selectRowAtIndexPath:firstRowPath animated:NO scrollPosition: UITableViewScrollPositionNone];
    [self tableView:self.tableView didSelectRowAtIndexPath:firstRowPath];
}
于 2013-05-10T02:57:09.680 に答える