开发者

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

开发者 https://www.devze.com 2023-04-07 13:24 出处:网络
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:

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

精彩评论

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