Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
Hi. I'm having some trouble using scrollRectToVisible.
I have a quiz screen where the user can select an answer to a question. What I want to achieve is when the user gets the question right the scrollview should scroll to the next page.
I managed to use the exact above to animate the scrollView when a user touches a certain area of the screen but cannot for the life of me work out how to use it when a user clicks the correct button.
Yet, when I try and call scrollRectToVisible when the user taps the correct answer and log the contentSize.width to the console, the console says that my contentSize.width value is zero. However, when I log the contentSize in viewDidLoad, the console output is the value I want.
I don't set the contentSize of the scrollView anywhere else so I can't understand how the content size is getting reset to zero.
Any help you can give me is much appreciated and I apologise for what is quite a long post for something that is probably very simple. Thanks.
Okay, I've established that if I use a button to scroll the scrollView then it works. So using scrollRectToVisible within an IBAction tied to a button works fine and logs the right contentSize of my scrollView. But, if I try and initiate the method from another method, the contentSize of the scrollView equals 0. Does anyone have any idea why that would be?
Make sure you're formatting your debugging string to the console for a float where you put the width; I had it set up as an int in the formatting string, and it always said zero for the width when in fact it was a perfectly valid floating-point number.
Replies
Thanks.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome