0

とは相互にリンクされている2つのビューがAlllocationsViewControllerあります。LoactionsViewController

ストーリーボードでは次のように表示されます。

ここに画像の説明を入力してください

AlllocationsViewControllerへのリンクの各セルはLocationsViewController、tableViewで表示するデータを送信します。AlllocationsViewController.m

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ 
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

    LocationsViewController *locationsViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"LocationsViewController"];

    //Will send the data from the cell to the next view into 'locationlink', which is set as property in LocationsViewController.h to retrieve the data
    locationsViewController.locationlink = cell.detailTextLabel.text;   

    [self.navigationController pushViewController:locationsViewController animated:YES];

} 

次に、これらのビューにTabBarを配置します。

ここに画像の説明を入力してください

データを挿入した後、以下のコードをそのままにしておくと、TableCellはユーザーをTableView(LocationsViewController)に送信しますが、TabBarは表示されません。TabBarも表示されるように、以下のコードで何を変更する必要がありますか?今、locationsViewControllerではなくTabBarにリンクする必要がありますか?または、LocationsViewControllerでTabBarを設定する必要がありますか?助けていただければ幸いです。

4

1 に答える 1

1

多分これは少し遅いですが、私はあなたを助けることができると思います。

私はPrepareForSegueを使用することを好みますが、あなたの場合は次のようなものを使用できます...

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
     UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    ClassTabBar *TabBarController = [self.storyboard instantiateViewControllerWithIdentifier:@"TabBarClientes"];
    Locations *locationViewController = [TabBarController.viewControllers objectAtIndex:0]; // you can use the index you need
    locationViewController.locationlink= cell.detailTextLabel.text;  
    [self.navigationController pushViewController:TabBarController animated:YES];
}

私が何か他のことであなたを助けることができるかどうか教えてください

于 2012-07-05T16:04:12.557 に答える