の行を選択することは可能ですか? UITableview。 正確に何が起きているのかをより明確に把握するために画像サンプルを提供しました。朝のワークアウト画面で** previous ** UITableviewで行を選択することはできますか?
http://img186.imageshack.us/img186/933/picture8a.png
http://img405.imageshack.us/img405/9327/picture9d.png
http://img200.imageshack.us/img200/5386/picture10thm.png
それはムービーを再生しますので、1行を選択し、その背後にあることができます。 ムービーが再生されている場合は、2番目のボタンを押すと最終的なテーブルに移動します。 戻るボタンを押すと、前の画面に戻ります。
ここに私の問題があります。 2番目のボタンを押した後に最終画面に戻って、前のビデオ(つまり以前に選択したセルに接続されているビデオ)を再生できる場合は、バックボタンを押してください。
実際には最初に選択した行を実際に選択できるような関数や何らかのアクションを作成することができます(この例ではLunge Forwardなど)。
previousRow = [ self.tableView indexPathForSelectedRow];
[self tableView:[self tableView] didSelectRowAtIndexPath:previousRow];
のようないくつかの誰かが私に教えてしまう場合は、それが不可能な場合でも、私はそれを感謝が
を何かをすると、おそらく 。
編集:ビデオ
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//Get the dictionary of the selected data source.
NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];
//check to see if video must be played
NSString *playVids = [dictionary objectForKey:@"playVids"];
finalscreen = [dictionary objectForKey:@"finalScreen"];
if(playVids == nil)
{
if(CurrentLevel != 0)
{
if(finalscreen == nil)
{
NSString *movies = [dictionary objectForKey:@"movieID"];
NSURL *movie = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:movies ofType:@"m4v"]];
theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movie];
[theMovie setOrientation:UIDeviceOrientationPortrait animated:NO];
[theMovie setScalingMode:MPMovieScalingModeAspectFit];
theMovie.backgroundColor = [ UIColor whiteColor];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(myMovieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:theMovie];
[theMovie play];
[self getToolBarStuff];
lblTitle.text = [dictionary objectForKey:@"Title"];
[[[UIApplication sharedApplication]keyWindow]addSubview:toolbar2];
[[[UIApplication sharedApplication]keyWindow]addSubview:imageView];
[[UIApplication sharedApplication]keyWindow]addSubview:lblTitle];
}
}
else
{
WebViewController *web = [[WebViewController alloc] initWithNibName:@"WebView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:web animated:YES];
[web release];
}
}
else {
//Prepare to tableview.
rvController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]];
//Increment the Current View
rvController.CurrentLevel += 1;
//Set the title;
rvController.CurrentTitle = [dictionary objectForKey:@"Title"];
//Push the new table view on the stack
[self.navigationController pushViewController:rvController animated:YES];
rvController.tableDataSource = Children;
[rvController release];
}
}
をプレイするために起こっているとき、ここで は、セルの背後にあるいくつかのコードで、私は私の情報は、/ dictionaryfileからのフィードを取得し、また私の辞書に異なるタグがとき私のテーブルビューを伝えますビデオを再生する場合と再生しない場合(playVids)。
正確には、私はあなたに2番目の画面を表示し、1つは朝のワークアウト画面に移動し、そこからセルをクリックすると(各セルごとに異なる)ビデオを再生します。この割り当ては特に自分のデザインを使用するように頼んでいるので、私はリンゴの標準デザインを使用することはできません(上のバックボタン付き)。 それは私が自分のタブバーとバックボタンを作成した理由です。
私の戻るボタンは、この
-(void)back_clicked:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
CurrentLevel--;
switch(CurrentLevel) {
case 0;
[toolbar removeFromSuperView];
default:
break;
}
}
のように見えるので、私は最後の画面にいる場合、私はちょうど私の前の1(朝のワークアウト)に戻るには、その画面を開きます。そして、実際に行われなければならないことは、そのスクリーンをポップして最後のビデオを再生することです。私は、最後の画面をポップしてから、朝のワークアウトで以前にクリックされたセルを選択することで、そのことができると思いました。
ご返信いただきありがとうございます。実際、私は複数のコントローラーを持っています。しかし、これらは実際にはここでは適用されません。私はこのようなドリルダウン可能なものを使用しています。 http://www.iphonesdkarticles.com/2009/03/drill-down-table-view-with-detail-view.html。 私は1つのコントローラを使用してテーブルビューを制御しています。また、ビデオ(タイトルとボトムバー)にオーバーレイビュー用の別のコントローラもあります。私は私の質問を編集し、より正確になるようにいくつかのコードを追加します。このコメントボックスでは、読んで痛いと思います。 –