Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 2 mysql表和swift表视图_Ios_Mysql_Json_Uitableview_Swift - Fatal编程技术网

Ios 2 mysql表和swift表视图

Ios 2 mysql表和swift表视图,ios,mysql,json,uitableview,swift,Ios,Mysql,Json,Uitableview,Swift,我正试图用swift编写一个小应用程序,但我是编程新手。 我在数据库中有两个表Singers和Songs。我用json在TableView中显示歌手列表。但是我一点也不知道该怎么办 1.选择歌手2。选择歌手的歌曲3。播放宋的视频 歌手表SingerRid,singername=> 歌曲表songid、songname、songvideurl、singerid=>我不这么认为这是一项非常困难的任务。你可以按照下面的方法做 //On singerTableViewController on cell

我正试图用swift编写一个小应用程序,但我是编程新手。 我在数据库中有两个表Singers和Songs。我用json在TableView中显示歌手列表。但是我一点也不知道该怎么办

1.选择歌手2。选择歌手的歌曲3。播放宋的视频

歌手表SingerRid,singername=>
歌曲表songid、songname、songvideurl、singerid=>

我不这么认为这是一项非常困难的任务。你可以按照下面的方法做

//On singerTableViewController on cell selection
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
   SongTableViewController *songTableViewController=<get from story board>
    songTableViewController.singerID=<get from your array>//you can use this to load song list from song table

[self.navigationController pushViewController:songTableViewController animated:YES];
}

//On SongTableViewController

-(void)viewDidLoad
{
 // get all songs list using singer ID and fill your song table
}

//On SongTableViewController on cell selection
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
   SongPlayViewController *songPlayViewController=<get from story board>
    songPlayViewController.songID=<get from your array>//you can use this to play song on SongPlayViewController

[self.navigationController pushViewController:songPlayViewController animated:YES];
}

//On SongPlayViewController

-(void)viewDidLoad
{
 // play your song based on your songID
}

为什么不连接这两个表,创建一个表,然后用一个json对象调用它呢。我想你必须制作2个UITableViewController singerViewController推送到SongViewController,这将推送播放歌曲,1个UIViewController推送播放歌曲,并根据每个推送获取数据。你想知道是否有这样的例子吗。我在网上找不到好的例子。你有例子吗@沙石3456643我很困惑,请帮帮我