123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- //
- // SelectTypeViewController.m
- // FreeMusic
- //
- //
- #import "SelectTypeViewController.h"
- #import "DBDaoHelper.h"
- @interface SelectTypeViewController ()
- {
- NSArray * array;
- }
- @end
- @implementation SelectTypeViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view from its nib.
- [self.navigationController setNavigationBarHidden:YES animated:NO];
- self.view.backgroundColor = [UIColor whiteColor];
- self.navigation.leftImage = [UIImage imageNamed:@"nav_backbtn.png"];
- // self.navigation.headerImage = [UIImage imageNamed:@"nav_canadaicon.png"];
- // self.navigation.title = [NSString stringWithFormat:@"%@(歌曲%d)",_singerModel.name,_singerModel.songs_total];
- 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;
- // _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- [self.view addSubview:_tableView];
- array = [DBDaoHelper myType];
- }
- - (void)viewWillAppear:(BOOL)animated {
- self.parentViewController.tabBarController.tabBar.hidden = YES;
- }
- -(void)viewWillDisappear:(BOOL)animated {
- self.parentViewController.tabBarController.tabBar.hidden = NO;
- }
- #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];
- }
- NSString * model = [array objectAtIndex:indexPath.row];
- cell.textLabel.text = model;
- return cell;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 44;
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- if ([self.delegate respondsToSelector:@selector(selectTypeViewController:selectType:)]) {
- [self.delegate selectTypeViewController:self selectType:indexPath.row];
- [self.navigationController popViewControllerAnimated:YES];
- }
- }
- - (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
|