I have a UISCrollview loading webviews, as the user starts scrolling to go to the next page, I need to have the the coming webpage to scroll into the screen from underneath another UIView that is stationary, I tried changing the alpha but its not really what I am looking for. how can I accomplish that?
For example, the scroll direction is top to bottom, now I have a uiview at the top of the screen which has some static data showing ( title, location, and other text labels ), and as the user scrolls down I want the content to scroll underneath the label ui view. Hope this clarifies it.
If I understand this question correctly I'd say you can't do this with a UIScrollView. Instead, you could have separate views for each UIWebView and handle the panning of one view under another with a UIPanGestureRecognizer.
Also, did you know there can be conflicts when using UIWebView's inside UIScrollView's?
Related
I have a UIPageViewController in which each of the child view controller contains a WKWebview.
The content of WebView is structured in two parts:
The top part contains a fixed size header in a div.
The bottom part contains the content, that can be larger than the device.
You can see a representation in the following drawing:
When the content is larger than the device, the user needs to scroll the content horizontally until the end of it in order for the UIPageViewController to start the swipe between two pages, and this is expected.
The problem is that the top part contains a fixed size header, and so if the user starts the scrolling in the header, it still need to scroll horizontally to the end of the content for the swipe to start. This is obviously not user friendly, and I am not sure how to solve this issue.
Do you have any suggestions about this?
You can try it something like:
Take two different UIPaginationViews, One for Header and one for
Contents.
Now, add these UIPaginationView's to ScrollView and enable vertical scrolling.
In delegate method, if the user scroll the page of Header
PaginationView then you can set the appropriate Index on the
Contents PaginationView. As the width of the Header is equal to the
width of the screen, so scrolling it to next page is smooth.
Now, when user scrolls on the bottom content and page get's
changed then you will have to set the index on the top pagination
view to match the contents pagination view.
In the scrollView, Allow only vertical scrolling. so, when you
scrolls it will scroll both the UIPaginations views.
it will need little experiments to get the desired behaviour and first thing you will have to do is to separate the HEADER AND CONTENT. if that is possible then you can try this approach.
Hope it helps.
I have a view where content is supposed to scroll over a few elements. One of which is a button. What I did is place the button and all background elements, and then created a scrollview on top of that.
However, the touch events now (obviously) go to the scrollview, and not to the elements in the back. Is it possible to enable interaction through the empty parts of a scroll view?
Screenshot here:
There is a scrollview on top of e.g. the "next" and "edit" buttons. but I'd like these to be clickable anyways.
Thanks.
I'm going to assume that the content you want to scroll is in a subview. ScrollViews always serve as the first layer of any scrollable UI. Put scrollview in your subview then UIView over your ScrollView and over that add your elements.
I have a complex design to create. I want to have something like this
- UIScrollView
--UILabel
--UILabel
--UIWebView
--UITableView
--UITextField
--UIButton
I am using a Storyboard and I want the ScrollView to take the height of the Full Webview and the TableView so that there is only one parent scrolling and other scrolls are disabled and the whole page seems like one single view.
Right now, the whole UI looks very messed up and only the Webview and table view scroll indivisually and the parent scrollview not scrolling at all making the labels and textfields have a constant place and the button not showing at all.
EDIT
Using raki's solution, I used a TableViewController. I have something like below:
But the webView does not cover its full content and just shows in the area shown in the image.
How can I solve this issue?
I am trying to recreate a UIView I have seen in multiple apps, mainly Shazam. The top half of the screen has some interactive buttons, and the bottom half looks like a tableView with custom cells. When the bottom half is panned/swiped up, the tableView scrolls over the top half with velocity, much like a scroll view.
I have been researching this and experimenting for a couple days now. I have gotten close, but not quite there.
My last approach was a view that had a tableView inside it. When the view was panned, the view would move to wherever the finger moved it to, but then would not have any velocity afterwards. Also when the tableView was panned/swiped down, it wouldn't move the whole view down.
Before that I tried a scrollView that took up the whole length of the screen. That gave the desired effect, but the button wasn’t tappable, and you could scroll the view in the button area, which is undesired.
Does it utilize ScrollViews or is it using a tableView that acts much like a ScrollView somehow.
Here is the Shazam UI/UX I am looking to recreate:
The top portion has interactive buttons, and doesn’t scroll. The bottom half shows content and when scrolled, covers up the top portion.
Below is what I have tried so far: This one is the panning view, which sort of works, but doesn’t have velocity and the tableView doesn’t scroll the view back down.
Any thoughts on a direction I can take from here is greatly appreciated. I am using Swift.
Cheers
This sort of thing is perhaps best done with a collection view and a custom layout — you can have some items for which you set layout attributes absolute to the view, and others relative to the scroll content offset.
There's a great (if wandering) discussion of this and other techniques in the Advanced User Interfaces with Collection Views talk from WWDC 2014.
This is actually simple than it seems at first. Here's how you can achieve this:
Create a UIViewController (not a UITableViewController).
Add some buttons to the top area of the screen.
Add a table view spanning the entire view controller's view. Make sure the table view is on top of the buttons added in the previous step.
Configure the top cell of the table view to be transparent (by setting its background color to Clear). Set the background color on the table view to Clear as well. This way it won't obscure the elements at the top of the screen, unless the table is scrolled up.
Because your table view is now transparent, you'll need to explicitly set the background color on the table cells other than the top one.
Profit!
I have a UIScrollView on my screen and there are some UIButtons on the scroll view.
I also have a UITableView which is above the scroll view, i.e. the tableview and the scrollview are overlapped.
Why I did this is because I want left and right swipe to flip pages of the scroll view and up/down swipe to show some text on the tableview.
This works fine except the button on the scroll view cannot be tapped. It seems that the tableview "absorbed" the tap event and it did not pass it to the button on the scrollview.
Is there someway to fix this? Thank you.
This could be a solution but I'm not sure of it because from your question I can't understand your problem very well, you can try it but if it doesn't work we will try a different way. Maybe the problem is the arrangement of the UI elements in your Interface Builder/Storyboard. If I correctly understood your situation you have something like this:
To make to UIButtons clickable you have to be sure they're at the highest level of arrangement inside the UIScrollView since the UITableView could cover them and "absorb" [as you said] the touch input. So my suggestion is: arrange your UI elements following the blue arrow in the picture below, placing the UIButtons on top, in this way they'll be 100% clickable.
If I didn't understand your question could you please shoot a picture like the one I've posted so I can understand it better?