خرید بک لینک

Vote count: 0

I am showing some rows into the UITableView and the count of the rows in the header of the section, but when i delete the rows then the view looks very weird will deleting with animation. Look into my code if i am missing something.

- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view = [[[UIView alloc]init] autorelease];

    view.backgroundColor = [UIColor colorWithRed:(249.0/255.0) green:(249.0/255.0) blue:(249.0/255.0) alpha:1];

    UILabel *label = [[[UILabel alloc]initWithFrame:CGRectMake(15, 15, 100, 15)] autorelease];
    [label setTextColor:[UIColor colorWithRed:0.56 green:0.56 blue:0.58 alpha:1.0]];
    [label setFont:[UIFont fontWithName:@"HelveticaNeue" size:12]];
    label.text = @"SELECTED ACCOUNTS (";

    NSString *numberOfAccounts = [NSString stringWithFormat:@"%li)", (unsigned long)[self->_selectedAccounts count]];

    if([self->_selectedAccounts count])
         label.text = [label.text stringByAppendingString:numberOfAccounts];

    [view addSubview:label];
    [view sizeToFit];
    [label sizeToFit];
    retu view;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0)
    {
        NSMutableArray *selectedAcc = [[NSMutableArray alloc] initWithArray:self->_selectedAccounts];
        [selectedAcc removeObjectAtIndex:indexPath.row];
        self->_selectedAccounts = selectedAcc;
        [self->_MyTableView beginUpdates];
        [self->_MyTableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationTop];
        [self->_MyTableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationNone];
        [self->_MyTableView endUpdates];
    }
}

asked 3 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 12 خرداد 1395 ساعت: 16:51

صفحه بندی