iPhoneアプリケーションを開発していて、グループ化されたテーブルビューのセクションを確認する際に問題があります。私がtableviewをスクロールして、最初のセクションがもう見えなくなり、tableviewが戻ってくると、2番目のセクションは最初のセクションから設定を取得しますか?私はそれがindexPath.section値を持つセクションをチェックします。これをどうすれば解決できますか?申し訳ありませんが私の英語が正しくない場合!前のセクションが画面外になったときのUITableViewセクションiPhone
申し訳ありませんコードが不足しています。ここ はcellForRowAtIndexPathコードの一部です:
- (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];
}
if(indexPath.section == 0){
pinSwitch.hidden = YES;
cell.imageView.image = [UIImage imageNamed:@"test_item.png"];
if([headarray count] != 0){
if(indexPath.row > [headarray count] - 1){
cell.imageView.alpha = 0;
cell.textLabel.text = [NSString stringWithFormat:@"Add new",indexPath.row + 1];
}
else{
cell.imageView.alpha = 1;
NSArray *infoarray = [headarray objectAtIndex:indexPath.row];
cell.textLabel.text = [infoarray objectAtIndex:0];
}
}
}
else if(indexPath.section == 1){
if(indexPath.row == 0){
//some more cell data
}
私は、これは私の問題を表示するのに十分であるべきだと思います!
: コードが一杯になっていないが、私はあなたがこのような何かを行うべきだと思いますbit diffuse..provideいくつかのコードを説明し、あなたは何をしようとしていますか? – Stas
具体的には、あなたが 'cellForRowAtIndexPath:'を見せることができれば、それを理解できるはずです。 – yuji