노래 페이지 표시
6484 단어 디 스 플레이
//
// 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