开发者

Xcode: Why does my UITextField act slow in my UITableViewCell?

I have an app where I loa开发者_StackOverflow社区d a UIViewController with an UITableView. In the UITableViewCells I have a UITextField. Which I have added in the cellForRowAtIndexPath:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Cell";

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

if (cell == nil) {

    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];

}

if ([indexPath section] == 0) {

    // Setting the cell textLabel.
    [[cell textLabel] setText:[Customize objectAtIndex:indexPath.row]];

    if ([indexPath row] == 0) {                  // Text

        // Adding and customizing UITextField.
        TextFieldText = [[UITextField alloc] initWithFrame:CGRectMake(160, 10, 140, 30)];

        TextFieldText.placeholder = @"Random";
        TextFieldText.autocorrectionType = UITextAutocorrectionTypeNo;
        TextFieldText.autocapitalizationType = UITextAutocapitalizationTypeNone;
        TextFieldText.returnKeyType = UIReturnKeyDone;

        [cell addSubview:TextFieldText];

and so on.

The problem is that when you type in it, it is a little slow. When a letter/symbol is typed it appears in the UITextField and for a very short second the marker is still on the left side of the letter/symbol and slide across the letter/symbol. The keyboard also appears kind of slow.

Any thoughts?

Thanks in advance :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜