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 回答