2016-05-13 7 views
1

TableViewの2つのセクションを使用しましたが、first section cell is dynamicsecond section cell is staticです。両方のセルにヘッダータイトルなしのセクションが1つあります。1つのセクションに2つのセクションの異なるセルを追加するグループ化されたテーブルビュー

enter image description here

私は、最初のセクションに静的セルを追加する必要が上の写真 - >最初のセルの下、最初のセルが動的に行数を増加させている、ここに私のコード

です
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
return 2; 

}

と行

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 

int count; 
     switch (section) { 
      case 0: 
       count = [nameArray count]; 
       break; 
      case 1: 
       NSLog(@"section called");  // This line is logged 
       count = 1; 
       break; 
      default: 
       count = 0; 
       break; 
     } 
     return count; 

} 

しかし、私はこのように必要な数、私は2番目のセクションヘッダーなしたい

enter image description here

は、静的セルはまずsection.Canあなたに追加私にこの問題を解決する方法を教えてください、ありがとう。

+0

G.P.Reddyテーブルビューの以下のデリゲートメソッドを使用して、動的高さとヘッダーのビューを処理することができます:おいいただきました問題を????第2セクションのヘッダを表示したいですか? ViewForHeaderInSection内の2番目のセクションヘッダーのビューを返し、それを表示します。私はあなたの質問を得る –

+0

なぜ静的および動的セルを2つの別々のセクションに入れたいのですか?なぜあなたは両方を1つのセクションに入れ、そのセクションのヘッダーを設定しないのですか? – MudOnTire

+0

私は最初のセクションに静的なセルの追加をしたい、最初のセクションで>最初のセルは動的なカウント@SandeepBhandari –

答えて

0

//あなたは

- (CGFloat)tableView:(HBTableView *)tableView heightForHeaderInSection:(NSInteger)section 
{ 
switch (section) { 
     case 0: 
      return 60; 
     case 1: 
      return 40; 
     default: 
      return 0; 
      break; 
    } 

} 



- (UIView *)tableView:(HBTableView *)tableView viewForHeaderInSection:(NSInteger)section 
{ 

switch (section) { 
     case 0: 
      return view1 
     case 1: 
      return view2 
     default: 
      return view3 
      break; 
    } 
} 
関連する問題