123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- //
- // DownViewController.m
- // FreeMusic
- //
- //
- #import "DownViewController.h"
- #import "DBDaoHelper.h"
- #import "FMMusicViewController.h"
- #import "MusicModel.h"
- @interface DownViewController ()
- {
- NSArray * array;
- }
- @end
- @implementation DownViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- self.navigation.title = @"下载列表";
- [self.navigationController setNavigationBarHidden:YES animated:NO];
- self.view.backgroundColor = [UIColor whiteColor];
- self.navigation.leftImage =nil;// [UIImage imageNamed:@"nav_backbtn.png"];
- self.navigation.rightImage = nil;
- self.navigation.navigaionBackColor = [UIColor colorWithRed:192.0f/255.0f green:37.0f/255.0f blue:62.0f/255.0f alpha:1.0f];
- _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.navigation.size.height+self.navigation.origin.y, self.view.size.width, self.view.size.height-self.navigation.size.height-48.5f)];
- _tableView.delegate =self;
- _tableView.dataSource = self;
- [self.view addSubview:_tableView];
- }
- -(void)viewWillAppear:(BOOL)animated{
- array = [DBDaoHelper selectDownMusicWithType:1];
- [_tableView reloadData];
- }
- #pragma mark - Table view data source
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- //#warning Potentially incomplete method implementation.
- // Return the number of sections.
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- //#warning Incomplete method implementation.
- // Return the number of rows in the section.
- return [array count];
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- NSString * dentifier = @"cell";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:dentifier];
- if (cell == nil) {
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:dentifier];
- }
- FMSongListModel * model = [array objectAtIndex:indexPath.row];
- cell.textLabel.text = model.title;
- return cell;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 44;
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- // NSMutableArray *arr = [[NSMutableArray alloc]init];
- // for (NSInteger i = 0; i<array.count; i++) {
- // FMSongListModel * model1 = [[FMSongListModel alloc]init];
- // MusicModel * musicModel1 = [array objectAtIndex:indexPath.row];
- // model1.song_id =musicModel1.songid;
- // [arr addObject:model1];
- // }
- FMSongListModel * model = [array objectAtIndex:indexPath.row];
-
- FMMusicViewController * pushController = [FMMusicViewController shareMusicViewController];
- pushController.songListModel = model;
- pushController.array = array;
- pushController.index = indexPath.row;
-
- pushController.only = NO;
- [pushController playMusicWithSongLink:model];
- [self.navigationController pushViewController:pushController animated:YES];
- }
- /*
- #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
|