Клавиатура не появляется на Iphone - PullRequest
0 голосов
/ 19 сентября 2011

Я добавил в некоторые строки в табличном представлении текстовое поле, например:

  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {

        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
        // cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        // cell.accessoryType = UITableViewCellAccessoryNone;

        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.backgroundColor = [UIColor clearColor];
        cell.selectionStyle = UITableViewCellSelectionStyleGray;
        cell.backgroundView.opaque = NO;
        //cell.alpha = 0.65;

        cell.textLabel.backgroundColor = [UIColor clearColor];
        cell.textLabel.opaque = NO;
        cell.textLabel.textColor = [UIColor whiteColor];
        cell.textLabel.highlightedTextColor = [UIColor whiteColor];
        cell.textLabel.font = [UIFont boldSystemFontOfSize:18];

        cell.detailTextLabel.backgroundColor = [UIColor clearColor];
        cell.detailTextLabel.opaque = NO;
        cell.detailTextLabel.textColor = [UIColor whiteColor];
        cell.detailTextLabel.highlightedTextColor = [UIColor whiteColor];
        cell.detailTextLabel.font = [UIFont systemFontOfSize:14];

        if(indexPath.row==1)
        {
            code=[[UITextField alloc] init];
            code.frame = CGRectMake(200,10,80,50);
            code.textColor=[UIColor grayColor];
            code.text=@"515800";
            [cell.contentView addSubview:code];

        }
        if(indexPath.row==2)
        {
            ville=[[UITextField alloc] init];
            ville.frame = CGRectMake(200,10,80,50);
            ville.textColor=[UIColor grayColor];
            ville.text=@"Paris";
            [cell.contentView addSubview:ville];

        }
        if(indexPath.row==4)
        {
            nomdepartenaire=[[UITextField alloc] init];
            nomdepartenaire.frame = CGRectMake(200,10,80,50);
            nomdepartenaire.textColor=[UIColor grayColor];
            nomdepartenaire.text=@"Alliantis Ttttt";
            [cell.contentView addSubview:nomdepartenaire];

        }
    }

    // Set up the cell...
    [[cell textLabel] setText: [listData objectAtIndex:indexPath.row]] ;

    return cell;
}

Проблема в том, что клавиатура не появляется, если я хочу изменить текст из TextField.Почему?

1 Ответ

0 голосов
/ 19 сентября 2011

Скорее всего, в текстовом поле есть что-то, что делает его недоступным для события касания.Добавление всего cellForRowAtIndexPath, вероятно, поможет нам лучше понять, что происходит.Кроме того, вы должны добавить текстовое поле и другие пользовательские элементы в cell.contentsView, а не непосредственно в ячейку.

...