一区二区三区日韩精品-日韩经典一区二区三区-五月激情综合丁香婷婷-欧美精品中文字幕专区

分享

UITableViewStyleGrouped 樣式的TableView

 oskycar 2015-01-01

UITableViewStyleGrouped 樣式的TableView 適合用于應(yīng)用程序的屬性設(shè)置:

這樣的TableView 與普通的TableView 在程序設(shè)計(jì)上沒有什么差別。只是在- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 方法中處理各個(gè)單元時(shí)需要逐個(gè)對(duì)單元進(jìn)行處理。代碼:
 

@interface RootViewController : UITableViewController<UIPickerViewDelegate,UIPickerViewDataSource> {
 UISlider *musicVolumnControl;
 UISlider *gameVolumnControl;
 UISegmentedControl *difficultyControl;
 
 UISlider *shipStablilityControl;
 UISwitch *badGuyControl;
 UISwitch *debugControl;
 
 UITextField *versionControl;
 
}

@end

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 4;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
 if(indexPath.section ==3)
  return 260;
 return 45;
}

// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    switch(section){
  case 0:
   return 3;
   break;
  case 1:
   return 1;
  case 2:
   return 1;
  case 3:
   return 1;
 }
 return 0;
}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   
    static NSString *CellIdentifier = @"Cell";
   
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
  cell.selectionStyle = UITableViewCellSelectionStyleNone;
  switch([indexPath indexAtPosition:0]){
   case 0:
    switch([indexPath indexAtPosition:1]){
     case 0:
      musicVolumnControl = [[UISlider alloc]initWithFrame:CGRectMake(170, 0, 125, 50)];
      musicVolumnControl.minimumValue = 0.0;
      musicVolumnControl.maximumValue = 10.0;
      musicVolumnControl.value = 3.5;
      [cell addSubview:musicVolumnControl];
      cell.textLabel.text = @"Music Volumn";
      break;
     case 1:
      gameVolumnControl = [[UISlider alloc]initWithFrame:CGRectMake(170, 0, 125, 50)];
      gameVolumnControl.minimumValue = 0.0;
      gameVolumnControl.maximumValue = 10.0;
      gameVolumnControl.value = 3.5;
      [cell addSubview:gameVolumnControl];
      cell.textLabel.text = @"Game Volumn";
      break;
     case 2:
      difficultyControl = [[UISegmentedControl alloc]initWithFrame:CGRectMake(170, 5, 125, 35)];
      [difficultyControl insertSegmentWithTitle:@"Easy" atIndex:0 animated:NO];
      [difficultyControl insertSegmentWithTitle:@"Hard" atIndex:1 animated:NO];
      difficultyControl.selectedSegmentIndex = 0;
      [cell addSubview:difficultyControl];
      cell.textLabel.text = @"Difficulty";
      break;
    }
    break;
   case 1:
    switch([indexPath indexAtPosition:1]){
     case 0:
      shipStablilityControl = [[UISlider alloc]initWithFrame:CGRectMake(170, 0, 125, 50)];
      shipStablilityControl.minimumValue =0.0;
      shipStablilityControl.maximumValue = 10.0;
      shipStablilityControl.value = 3.5;
      [cell addSubview:shipStablilityControl];
      cell.textLabel.text = @"Ship Stability";
      break;
     case 1:
      badGuyControl = [[UISwitch alloc]initWithFrame:CGRectMake(200, 10, 0, 0)];
      badGuyControl.on = YES;
      [cell addSubview:badGuyControl];
      cell.textLabel.text = @"Bad Guys";
      break;
     case 2:
      debugControl = [[UISwitch alloc]initWithFrame:CGRectMake(200, 10, 0, 0)];
      debugControl.on = YES;
      [cell addSubview:debugControl];
      cell.textLabel.text = @"Debug";
      break;
    }
    break;
   case 2:
    versionControl = [[UITextField alloc]initWithFrame:CGRectMake(170, 10, 125, 38)];
    //versionControl = [[UITextField alloc]initWithFrame:CGR
    versionControl.text = @"1.0.0 Rev. B";
    [cell addSubview:versionControl];
    cell.textLabel.text = @"Version";
    break;
   case 3:
    picker = [[UIPickerView alloc] initWithFrame:CGRectMake(10, 20, 200, 50)];
    //CGSize pickerSize = [picker sizeThatFits:CGSizeZero];
    //picker.frame = [self pickerFrameWithSize:pickerSize];
    
    cellCategories = [[NSMutableArray alloc]initWithObjects:@"line 1",@"Line 2",@"Line 3",@"Line 4",@"Line 5",@"Line 6",nil];
    picker.delegate = self;
    picker.dataSource = self;
    picker.showsSelectionIndicator = YES;
    picker.multipleTouchEnabled = YES;
    picker.userInteractionEnabled = YES;
    
    //[picker becomeFirstResponder];
    [cell addSubview:picker];
    cell.textLabel.text = @"Picker";
    break;
  }
     }
   
 // Configure the cell.

    return cell;
}

 

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多

    亚洲欧美日韩在线看片| 国产肥女老熟女激情视频一区| 久久偷拍视频免费观看| 人妻巨大乳一二三区麻豆| 国内欲色一区二区三区| 国产肥女老熟女激情视频一区| 免费精品一区二区三区| 午夜福利国产精品不卡| 午夜福利国产精品不卡| 福利一区二区视频在线| 五月综合婷婷在线伊人| 国产精品不卡免费视频| 亚洲欧洲日韩综合二区| 欧美区一区二区在线观看| 一区二区日本一区二区欧美| 在线精品首页中文字幕亚洲| 日本不卡一本二本三区| 国产永久免费高清在线精品| 女人精品内射国产99| 韩国日本欧美国产三级| 中文字幕乱子论一区二区三区| 性感少妇无套内射在线视频| 午夜视频在线观看日韩| 欧美日韩黑人免费观看| 日本婷婷色大香蕉视频在线观看| 色婷婷视频国产一区视频| 精品欧美在线观看国产| 国产日韩欧美综合视频| 欧美精品亚洲精品日韩精品| 久久精视频免费视频观看| 亚洲熟妇熟女久久精品 | 69精品一区二区蜜桃视频| 我想看亚洲一级黄色录像| 欧美日韩国产精品第五页| 成人午夜在线视频观看| 精品亚洲av一区二区三区| 国产午夜福利不卡片在线观看| 东京不热免费观看日本| 国产丝袜美女诱惑一区二区| 国产精品福利精品福利| 国产精品香蕉免费手机视频|