加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

iphone – 如何推视图,回去看看?

发布时间:2020-12-14 19:47:17 所属栏目:百科 来源:网络整理
导读:我想制作一个应用程序来播放iPhone上的本地音频文件,但是我遇到了一些我的代码. 我想知道如何推送视图,回到uitableviewcontroller并使用按钮(如媒体播放器中的“NOW PLAYING”按钮)返回到视图,而不需要插入任何新的字符串. 谢谢 我的代码应该怎么改? 在uita
我想制作一个应用程序来播放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

    }

在mPlayerViewController.m

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

解决方法

如果您将视图推送到导航控制器,只需将其弹出以查看下方的视图.

也就是说,您推送myDetViewCont的视图应该只是在背板播放器调用中弹出.

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读