UITableview не прокручивается плавно - PullRequest
0 голосов
/ 10 февраля 2012

У меня есть UITableView в моем приложении, и я создал ячейку табличного представления обычно с созданием любого файла класса.В свою ячейку таблицы я добавляю UITextview, из-за чего мой UITableView имеет вид « не прокручивается плавно ».После того, как я прокомментирую код вида текста или заменим вид текста на текстовое поле / метку , прокручиваем вид таблицы так же плавно, как и положено.

Может кто-нибудь сказать мне, почему это происходит?Заранее спасибо.

Вот как я добавляю текстовое представление в таблицу:

    UITextView *txtview = [[UITextView alloc]
    initWithFrame:CGRectMake(93.0,36.0,190.0,94.0)];            
    txtview.backgroundColor = [UIColor clearColor];
    txtview.text = [NSString stringWithFormat:@"%@",strText];
    txtview.contentInset = UIEdgeInsetsMake(5 ,0 ,0 ,0); 
    txtview.textColor = [UIColor colorWithRed:221.0/255.0 green:249.0/255.0
    blue:250.0/255.0 alpha:1.0];   
    [cell.contentView addSubview:txtview];
    [txtview release];

Вот мой код генерации ячейки:

    UITableViewCell *cell = [tableView
                            dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (!cell) 
        cell =[[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 
              reuseIdentifier:CellIdentifier]autorelease];
    else
    {
      NSArray *arraySubviews = [cell.contentView subviews];

        for (UIView *views in arraySubviews)
        {
            [views removeFromSuperview];

        }
    }

1 Ответ

4 голосов
/ 10 февраля 2012
cell =(UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:identifier];  

        if (nil ==cell) {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier] autorelease];    
            UITextView *txtview = [[UITextView alloc]
                                   initWithFrame:CGRectMake(93.0,36.0,190.0,94.0)];            
            txtview.backgroundColor = [UIColor clearColor];
            txtview.tag = 15;

            txtview.contentInset = UIEdgeInsetsMake(5 ,0 ,0 ,0); 
            txtview.textColor = [UIColor colorWithRed:221.0/255.0 green:249.0/255.0
                                                 blue:250.0/255.0 alpha:1.0];   
            [cell.contentView addSubview:txtShout];
            [txtview release];
        }
        UITextView *txtview = (UITextView*)[cell.contentView viewWithTag:15];
        txtview.text = [NSString stringWithFormat:@"%@",strText];
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...