Alb*_*lby 9 iphone xcode uitableview uinavigationcontroller pushviewcontroller
我想构建一个用于在iPhone上播放本地音频文件的应用程序但我仍然坚持使用我的一些代码.我想知道如何推送视图,回到uitableviewcontroller并使用一个按钮(如媒体播放器中的"NOW PLAYING"按钮)返回视图,而不会将任何新字符串推入其中.
谢谢
我应该从我的代码中更改什么?
在uitableviewcontroller ..
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
*)indexPath {
selectedSong = [directoryContent objectAtIndex:indexPath.row];
NSString *storyLin = [[directoryContent objectAtIndex:[indexPath row]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
patch = [NSString stringWithFormat:@"/%@", storyLin];
myDetViewCont = [[mPlayerViewController alloc] initWithNibName:@"mPlayerViewController" bundle:nil];
myDetViewCont.myProgLang = selectedSong; // assigning the correct value to the variable inside DetailViewController
[self.navigationController pushViewController:myDetViewCont animated:YES];
[myDetViewCont release]; // releasing controller from the memory
}
Run Code Online (Sandbox Code Playgroud)
在mPlayerViewController.m中
-(IBAction) backtoplayer{
myDetViewCont = [[mPlayerViewController alloc] initWithNibName:@"mPlayerViewController" bundle:nil];
}
Run Code Online (Sandbox Code Playgroud)
Mar*_*ell 11
如果您已将视图推送到导航控制器,只需将其弹出以查看下方的视图.
也就是说,您推送的视图myDetViewCont应该只在backtoplayer通话中弹出.
- (IBAction)backToPlayer:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6905 次 |
| 最近记录: |