2

私はタブバーアプリケーションを開発しています。

1つの配列に9行(アカウントグループの名前)があるテーブルビューがあります。行を選択すると、別のビューが開き、入力AcctTitleして保存します。別のタブをクリックすると、テーブルビューが開き、アカウントグループに従って行が表示されます。

つまり、前のタブでxxxグループを選択し、5つのアカウントタイトルを1つずつ入力して保存すると、他のタブでは、セクションのヘッダーとしてxxxグループが表示され、そのセクションの行として5つのタイトルが表示されます。

グループが異なれば、行も異なります(2つの異なるタブ)。どうやってやるの?

4

5 に答える 5

1

この2つの方法を使用してください

//For Number of section
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

//For Number of Cell
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
于 2012-04-25T05:20:51.367 に答える
0

試してみる:

-(void)viewDidAppear:(BOOL)animated
{
    [tableview reloadData]
}

お役に立てれば。

于 2012-04-19T11:56:51.703 に答える
0

表示する必要があるセクションのリストを含む配列を定義します。そして

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return [urSectionlistArray count]}

そしてメソッドで

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ return [urSectionlistArray objectAtIndex:section]count];

定義されたさまざまなセクションに基づいて行数を定義します。

U メソッドでヘッダーのタイトルを定義できます

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{

return [urSectionlistArray objectAtIndex:section];

}

Uは上記のアプローチを試すことができます..

于 2012-05-03T14:03:45.047 に答える
0

セクション値の変更を使用するだけで、それらはすべて異なるグループにあり、これらのメソッドを使用します。

 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
   {
   if(section==0)
   {
    //what ever you want
   }
   if(section==1)
   {
   //what ever you want
    }
   }


  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
  if(section==0)
  {
  //what ever you want
    }
  if(section==1)
  {
  //what ever you want
  }
   }
于 2012-05-03T06:19:44.377 に答える