Can someone explain to me what the contentInset property in a UIScrollView instance is used for? And maybe provide an example?
Can someone explain to me what the contentInset property in a UIScrollView instance is
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It sets the distance of the inset between the content view and the enclosing scroll view.
Obj-C
Swift 5.0
Here’s a good iOS Reference Library article on scroll views that has an informative screenshot (fig 1-3) – I’ll replicate it via text here:
The scroll view encloses the content view plus whatever padding is provided by the specified content insets.