Unexpected UIPageViewController behaviour

女生的网名这么多〃 提交于 2019-12-04 06:56:02

I'm not sure what it is in your code that does this, but one probable approach in debugging this is to try and catch the UITextField's UIKeyboardWillShowNotification event to check if it's firing properly.

Also try to set a breakpoint at your page's viewWillAppear event to inspect if all of the UITextFields have been instantiated properly -- I would suspect that at the point where you tapped the first text field not all of them have instantiated yet, meaning that the object receiving the tap action will be your UIPageViewController instead of the UITextField.

VarunMurali

I found the answer here:

Cannot Impliment UITextview inside a UIPageViewController

Credit goes entirely to him.

I can confirm that it works. Here is what I did in my view controller:

//TextField
    UIScrollView *textFieldScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
    textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, width, height)];
    [textField setText:@""];
    [textField setBackgroundColor:[UIColor whiteColor]];
    [textField.layer setCornerRadius:5.0f];
    [textField setDelegate:self];

    [textFieldScrollView addSubview:textField];
    [_someView addSubview:textFieldScroll];

Works like a charm. Let me know if you have any more questions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!