scrollRectToVisible UITextField不使用Autolayout滚动

Ste*_*ser 2 uiscrollview uitextfield autolayout

[self.scrollView scrollRectToVisible:textField.bounds animated:YES];
Run Code Online (Sandbox Code Playgroud)

我似乎无法让我的UIScrollView完全滚动,因此它不会模糊我的UITextField.我认为scrollRectToVisible将是我的救世主,但它看起来像是不行.也许我错过了将textField的坐标转换为我的scrollView的内容.无论哪种方式,请查看我的示例项目.

https://github.com/stevemoser/Programming-iOS-Book-Examples/tree/master/ch20p573scrollViewAutoLayout2

哦,这个项目可能缺少委托连接,但我检查了它,它仍然不滚动.

我见过类似的其他问题,但没有提到Autolayout.

小智 7

scrollRectToVisible::转换为自动布局后,我也遇到了问题.我只是将其更改为直接调用setContentOffset::,它又开始工作了.