0

UITableView には、クリックすると 4 つのアニメーション化されたセルがドロップダウンするセクションがありますが、ドロップダウンするとビュー (画面) を超えて下に移動し、下にスクロールしないと表示されないという問題があります。セクションをクリックすると、ビュー全体が押し上げられてドロップダウンメニューのすべてのセルが表示されるようにするにはどうすればよいですか? これが私のコードです:

- (void) sectionOpened : (NSInteger) section{

    SectionInfo *array = [self.sectionInfoArray objectAtIndex:section];
    array.open = YES;

    NSInteger count = [array.category.list count];
    NSMutableArray *indexPathToInsert = [[NSMutableArray alloc] init];
    for (NSInteger i = 0; i<count;i++)
    {
        [indexPathToInsert addObject:[NSIndexPath indexPathForRow:i inSection:section]];
    }

    NSMutableArray *indexPathsToDelete = [[NSMutableArray alloc] init];
    NSInteger previousOpenIndex = self.openSectionIndex;
    if (previousOpenIndex != NSNotFound)
    {
        SectionInfo *sectionArray = [self.sectionInfoArray objectAtIndex:previousOpenIndex];
        sectionArray.open = NO;
        NSInteger counts = [sectionArray.category.list count];
        [sectionArray.sectionView toggleButtonPressed:FALSE];
        for (NSInteger i = 0; i<counts; i++)
        {
            [indexPathsToDelete addObject:[NSIndexPath indexPathForRow:i inSection:previousOpenIndex]];
        }
    }
    UITableViewRowAnimation insertAnimation;
    UITableViewRowAnimation deleteAnimation;
    if (previousOpenIndex == NSNotFound || section < previousOpenIndex)
    {
        insertAnimation = UITableViewRowAnimationTop;
        deleteAnimation = UITableViewRowAnimationBottom;
    }
    else
    {
        insertAnimation = UITableViewRowAnimationBottom;
        deleteAnimation = UITableViewRowAnimationTop;
    }

    [atableView beginUpdates];

    [atableView insertRowsAtIndexPaths:indexPathToInsert withRowAnimation:UITableViewRowAnimationTop];
    [atableView deleteRowsAtIndexPaths:indexPathsToDelete withRowAnimation:deleteAnimation];


    [atableView endUpdates];

    self.openSectionIndex = section;

} 

何か案は?

4

1 に答える 1