I have a List that I'm implementing in tvOS with swift UI and when scrolling down on the list, a gradient appears at the top of the list (presumably to indicate there are items above)
Essentially, what I'm looking for at the top of the List is:
But, I'm seeing this:
How do I remove that top gradient fade and simply have a straight edge?
Use a VStack (or LazyVStack) in a ScrollView. List uses UITableView behind the scenes, which has the fade, but ScrollView does not.
Related
In the below screenshots (taken from the Apple Developer app), we can see that the Account button sticks to the bottom of the sidebar.
When the window is tall enough (left), the list doesn’t scroll, Account button’s background color has no difference. When the window is not tall enough (right), causing the list to scroll, Account button changes its background color to reveal the relationship.
The list's scroll position can not be probed. How can I declare the Account button in SwiftUI?
That app is a UIKit catalyst app and the sidebar uses scrollViewDidScroll which uses the contentSize to set a bottomButtonState which is passed into a child UIHostingController (so the account button can be SwiftUI) which I would assume switches between a clear or solid background.
We cant get the scroll info in SwiftUI however a possible workaround would be to add dummy 1 pixel high cell to the bottom of the list and using its onAppear to set a binding that is used in a bottom view to enable/disable a background colour and should achieve the same effect.
Is it possible to move the selected item from horizontal ScrollView to the most far left position in the ScrollView? I can't use "scrollTo" which ScrollViewReader provides (iOS 13 support)
Bassicly I need to auto move the selected item so it becomes fully visible on the screen.
Any ideas?
Thanks in advance everyone!
I am working on a crossword app.
I have a SquareView that contains a Text and TextField, to show the number and letter for a particular square.
A 2D array of those SquareViews forms the grid of the puzzle.
I can navigate back and forth horizontally through the TextFields using the tab key, and all the highlighting works (current square yellow, adjacent answer squares blue, all others white or black).
My problem arises when I want to toggle navigation, to move vertically. I thought that the order in which TextFields were navigated depended on the order in which they were added, so I toggled between a VStack of HStacks (across clues, running horizontally) and HStack of VStacks (for down clues, running vertically). Nope. SwiftUI always moves from left-to-right, top-to-bottom. How can I change this? I learned from this forum about Introspect, so I can access each TextField's underlying UITextField and change ... it's color 😀, but that's not what I need. I need to be able to change order in which first responders are chosen.
Any assistance would be most welcome!
I am using swift gesture in my app But these swipes are just up - down - right and left - I want some thing more !!!
I want to have swipe gesture from one point to another point with x and y
for example from one point in the middle of the screen to another point near right with special X and Y
and the most important thing is that how can I use this code to all devices?! because when I am using for example iPhone 4s it is more different than iPad pro screen
One way you could do this is by adding a transparent view to the area of the screen that you want a gesture to be recognized in. So, if we consider your case, you could add a view that is presented over the center of its superview to some point near the right of its superview. Set the isOpaque property to false. Add a swipe gesture to this view with the target being the superview, and the action being the method of the superview that you want to execute when the swipe gesture is recognized on the newly added transparent subview.
Is it possible reverse the scroll position in a scrollview so it scrolls from the bottom up?
It would be helpful to do this because it would allow me to lay the scrollview flat and stand the surfaces up and still have the first surfaces at the front.It's a bit hard to explain so I have this image Basically I am trying to scroll through these surfaces like a filing system. Is there perhaps a better way to simulate this?