久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

UITableViewStyleGrouped 樣式的TableView

 oskycar 2015-01-01

UITableViewStyleGrouped 樣式的TableView 適合用于應用程序的屬性設置:

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

@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;
}

 

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

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多