1

テキストフィールドに州名 (アッサム、カルナタカなど) を入力する必要があるアプリケーションを作成しています。テキストフィールドの近くにボタンを作成しました。そのボタンをクリックすると、テーブルビュー (多くの状態が取り込まれている) が、テキストフィールドがあるビューにサブビューとして追加されます。私の問題は、ユーザーが状態のいずれかを選択したときに、状態名を含むテーブル ビューを閉じたいことです。ビューをサブビューとして追加しましたが、状態を選択するときにビューを閉じることができません。助けてください。事前に感謝します。

4

2 に答える 2

0

これを試して、

-(void)tableView:(UITableView *)tableView1 didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    your_viewController *vc=[[your_viewController alloc]init];
    UINavigationController *navController=[[UINavigationController alloc]initWithRootViewController:vc];
    [self.navigationController dismissModalViewControllerAnimated:YES];
    [navController release];
    [vc release];

}
于 2012-09-05T11:51:20.927 に答える
0
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil]; 
    youroldview *rvc = [storyboard instantiateViewControllerWithIdentifier:@"identifierof_oldview"];

    [self.navigationController pushViewController:rvc animated:YES];
}

ナビゲーションベースのアプリケーションの場合はそのビューに移動します。それ以外の場合は使用する必要があります

[self presentModalViewController:rvc animated:YES];
于 2012-09-05T12:38:13.517 に答える