1

の行数を更新する方法

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

展開するときは、行数を増やします。

`-(void)rotateButtonToExpanded:(UIButton *)aButton section:(int)aSection {

// Rotate the button with animation.
[UIView beginAnimations:ROTATE_TO_EXPAND context:nil];
[UIView setAnimationDuration:ANIMATION_DURATION];
aButton.transform = CGAffineTransformMakeRotation(M_PI*2.5);
[UIView commitAnimations];

// Save the state (expanded or collapsed) of button with index path as key.
BOOL isExpanded=![[mStateOfNodes objectAtIndex:aSection] isExpanded];
[[mStateOfNodes objectAtIndex:aSection] setIsExpanded:isExpanded];

NSArray*theDataOfChildCells=[[self.mNodes objectAtIndex:aSection] valueForKey:CHILD_NODES];


for (int i=0; i<theDataOfChildCells.count; i++) {
    mNumberOfCells++;

    [self beginUpdates];
    NSIndexPath*theIndexPath=[NSIndexPath indexPathForRow:i inSection:aSection];
    [self insertRowsAtIndexPaths:[NSArray arrayWithObject:theIndexPath] withRowAnimation:UITableViewRowAnimationMiddle];
    [self endUpdates];

}

}`
4

2 に答える 2

0

使用されたリロード データ メソッド、

[self.tableview reloadData];
于 2013-02-11T06:17:19.940 に答える
0

UITable特定の行とセクションで行を追加するために使用する次のコードを使用します

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowNO inSection:SectionNO];
        [self.tblView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
        rowNO=rowNO+1;
     [self.tblView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
        [self.tblView reloadData];
于 2013-02-11T06:19:50.923 に答える