zoukankan      html  css  js  c++  java
  • 歌曲页面显示

    //
    //  MusicList.m
    //  播放器
    //
    //  Created by apple on 14-7-24.
    //  Copyright (c) 2014年 apple. All rights reserved.
    //
    
    #import "MusicList.h"
    #import "ViewController.h"
    @interface MusicList ()<UITableViewDataSource,UITableViewDelegate>
    
    {
        ViewController *viewCt;
        
        NSArray *musiclist;//歌曲名列表    
    }
    @end
    
    @implementation MusicList
    
    - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            // Custom initialization
        }
        return self;
    }
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        UITableView *musicListTable=[[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
        musicListTable.delegate=self;
        musicListTable.dataSource=self;
        [self.view addSubview:musicListTable];
    //    musiclist=[[NSArray alloc]initWithArray:[viewCt musiclist1]];
        musiclist=@[@"Beyond-光辉岁月",@"G.E.M.邓紫棋-你把我灌醉",@"G.E.M.邓紫棋-回忆的沙漏 (国)",@"Beyond-海阔天空",@"Declan Galbraith-Tell Me Why"];
    }
    
    #pragma mark-行数设置
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        return 5;
    }
    
    
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"cell"];
        if (cell==nil)
        {
            cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        }
        
        cell.textLabel.text=[NSString stringWithFormat:@"%@",musiclist[indexPath.row]];
        return cell;
    }
    
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
    //    viewCt=[[ViewController alloc]init];
    //    [viewCt setIndex:indexPath.row];
        [self.pCV setIndex:indexPath.row];
        [self presentViewController:self.pCV animated:YES completion:^{
            NSLog(@"进入播放页面");
            [self.pCV play];
        }];
    }
    
    - (void)didReceiveMemoryWarning
    {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    
    /*
    #pragma mark - Navigation
    
    // In a storyboard-based application, you will often want to do a little preparation before navigation
    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
        // Get the new view controller using [segue destinationViewController].
        // Pass the selected object to the new view controller.
    }
    */
    
    @end
  • 相关阅读:
    IOS 11 通讯录手机号「隐形字符」的 Bug
    本地添加const参数 防止短信接口恶意调用
    javascript阿拉伯数字 转 汉字中文数字
    js去掉数组的空字符串
    Chrome 清除某个特定网站下的缓存
    vue-cli中的babel配置文件.babelrc详解
    提交到github报错Please tell me who you are
    跨域问题
    js单线程、js任务队列、异步操作
    Java 异常
  • 原文地址:https://www.cnblogs.com/lidongq/p/3867162.html
Copyright © 2011-2022 走看看