【发布时间】:2009-09-23 13:00:02
【问题描述】:
是否可以在 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
在晨练屏幕上,可以选择一行并在其后面播放电影。 如果电影播放,您可以按第二个按钮,它将带您进入决赛桌。 如果您按下后退按钮,您将简单地返回到上一个屏幕。
现在这是我的问题所在。 如果我在按下第二个按钮后进入最终屏幕并按下后退按钮,那么如果它可以播放上一个视频(换句话说,视频连接到之前选择的单元格)会很棒
因此,如果我可以创建一个函数或某种动作,它们实际上可以从第一个字段中选择先前选择的行(例如本例中的 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];
}
}
我从字典文件中获取信息/提要,并且字典中的不同标签告诉我的 tableview 何时播放视频以及何时不播放视频 ( playVids )。
确切地说,我有一个开始屏幕,它会将您带到第二个屏幕,然后将您带到早晨锻炼屏幕,如果您从那里单击一个单元格,它将播放一个(每个单元格都不同)视频。我不能使用苹果的标准设计(带有上面的后退按钮),因为这个任务特别要求使用他们自己的设计。 这就是我创建自己的标签栏和后退按钮的原因。
我的后退按钮是这样的
-(void)back_clicked:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
CurrentLevel--;
switch( CurrentLevel ) {
case 0;
[toolbar removeFromSuperView];
default:
break;
}
}
因此,如果我在最后一个屏幕中,我只需弹出该屏幕即可返回上一个屏幕(早上锻炼)。实际上必须做的是弹出该屏幕并播放最后一个视频。我想我可以通过弹出最后一个屏幕然后在早上锻炼中选择先前单击的单元格来做到这一点。
对此有任何想法。
【问题讨论】:
标签: iphone objective-c uitableview