Reproducing Popular iOS Controls - Part 4: | Ray Wenderlich Videos

Scrolling is a really useful vehicle for animations. In this video, find out how to use it with interactive interpolation and normalization.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5298-reproducing-popular-ios-controls/lessons/4

Did I miss the scrolling view part ? Only way you can scroll is by clicking on those buttons after part 4 tutorial is completed. I think either I’m half awake or she completely forgot to implement that part. :smiley: .

1 Like

Hey rikenm, we definitely do implement the scrolling :stuck_out_tongue:

Check out Video 4 after at 3 minutes. After that, it’s all about the scrolling!

You can also see that you can, in fact, scroll on the final project from the materials you’ve downloaded.

I think My machine has some kind of problem. I’m not able to scroll even in final project. I’m still using older version of Xcode.

Hi Lea
I’m afraid I’m a little confused by the scrolling too. At the end of video 3 we can scroll the 3 child views (chat, lens, discover) with the buttons but not by swiping with a finger. Video 4 starter project has the swiping enabled but I can’t find the code added since the final project from video 3. How has the finger swiping been enabled?

Other than that I’m loving this series (early days I know) and can’t wait for the App Store and Map chapters.

EDIT:- Aaah, overriding hitTest, got it :slight_smile:

I went through this video more than 4X times and was still unable find that. Thanks :slight_smile:

Hi!

Yes, overriding the hitTest function is what makes the user able to scroll because we’re passing through the touches. Sorry for the oversight of not mentioning that addition in the course!

What’s more important, though, is making sure that we capture the scrolling behavior (which is what happens at 4:27 to the end of video 4) in a way that lets us use the specific scrolling values to drive the pertinent animations.

Hi!

I’m sorry that your final project doesn’t scroll. I’m a little confused why that would be happening because it does scroll for me when I download the files. I am using Xcode 10, which is the Xcode used for this course, but after I make some adjustments (mentioned in the comments for this part of the course), I can also scroll just find on the project ran through Xcode 9.

I’d have to test your project specifically in order to troubleshoot further.

Hello!
I have the same problem. I thought that it was a problem with XCode 9.4. But I have installed Xcode 10 beta and the same problem is presented.
EDIT:
The problem is with NavigationView, it handles touch events.

SOLUTION:

add this lines of code to NavigationView class:

override func hitTest(_ point: CGPoint, with event: UIEvent?) → UIView? {
let view = super.hitTest(point, with: event)
return view == self ? nil : view
}

Adding the hitTest function fixed it for me.

Yes! If you download the materials from the video part you’re on, the function is already added. I recommend, in general, to download the materials for the specific videos and not just assume that everything that we add will be covered - unfortunately there’s just not enough time in these 10 minutes videos to go through everything.

Did you initially download the project files from the 4th video? If not, we don’t include adding the hitTest function in the video, so you would be left without it.

I recommend downloading the materials for each video specifically.

Hi Lea I am loving your course and clear style.

I just joined. However the link Download project files keep hiding quick once any page on this video course loads.

It is very annoying as I cannot follow the projects or reproduce the work in effective manner.

Please assist.

thank you

Ahmed

Hi!

I’m glad you like the course. I’m not sure why the button is hiding, but I’ll reach out to our support team :slight_smile:

Reached out! If you’re still having problems feel free to reach out to support@razeware.com and describe your issue in detail.

Thank you @leamars, I will do that as the forum acts up on Chrome browser too. I am using the RW site on Safari.

I need to ask a question related to UI with all the animations on the Apple Store part. We only used DispatchQueue.main in the last part to delay the UI animations and we did not need it before, is that because all the other functions and delegates used in process account on work thread?

I remember in the Animations book that you have to always enclose all the action on main thread.

Please let me know if I need to be more clear.

@leamars just a small reminder on my question… thx

@leamars Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hey @albaqawi for your animations questions with the DispatchQueue. I’m not entirely sure what you mean.

All UIKit work, including animations, should always be performed on the main thread. When we’re doing UIKit standard UIKit animations, any work that has to happen after the animations completes can be put in their completion block. We’re using DispatchQueue on the last part of the scrolling, because it’s not technically an animation. The values there change based on the user input. We’re using DispatchQueue there simply to avoid the jerkiness of the dismissal animation and give a little bit of delay before that happens so that the dismissal is not as jarring.

I’m not sure I answered your question, so please let me know if there’s something else I can clarify.

:sweat_smile: at least using my final project from lesson 3 helped me to realize I need the hitTest :sweat_smile:
can anyone explain me why it is needed?
@leamars