// // 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