gpt4 book ai didi

iphone - 如何推送一个 View ,返回并返回 View ?

转载 作者:行者123 更新时间:2023-12-03 18:32:27 24 4
gpt4 key购买 nike

我想构建一个在 iPhone 上播放本地音频文件的应用程序,但我的一些代码被困住了。我想知道如何推送 View ,返回 uitableviewcontroller 并使用按钮(如媒体播放器中的“正在播放”按钮)返回 View ,而不将任何新字符串插入其中。

谢谢

我应该对代码进行哪些更改?

在 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

}

在mPlayerViewController.m

-(IBAction) backtoplayer{
myDetViewCont = [[mPlayerViewController alloc] initWithNibName:@"mPlayerViewController" bundle:nil];
}

最佳答案

如果您已将 View 推送到导航 Controller 上,只需弹出它即可查看下面的 View 。

也就是说,您推送的 View myDetViewCont 应该在 backtoplayer 调用中弹出。

- (IBAction)backToPlayer:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}

关于iphone - 如何推送一个 View ,返回并返回 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5332199/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com