How to create a reversed Bottom Sheet from the top in iOS? - ios

I need to implement a reversed bottom sheet which should be sliding from the top of the parent view to the bottom.I have done my research and found plenty of supported libraries, but all of them don't work with sliding from the top of the view. I have tried to apply translation and reverse a drawer layout by 180 degrees in Pulley, but it created issues with safe area in iPhoneX for example.
Perhaps I am overcomplicating things with manually editing libraries, but I would like to get possible solutions or sample codes for creating this particular UI.
It should be done with regular interface builder in code, not in Swift UI at the moment.

Perhaps the easiest way is create it manually?
It's not that hard to create a black overlay that animates in while having a rounded corners white view animating from the top?
I think editing existing libraries to make it work is more work than doing this yourself? :)
I can supply some code if you need it but perhaps try it yourself and come back with your code and I can help update it to make it work properly?

Related

Swift Animation Similar to Line Chart

my question can be a little bit confusing, however I will do my best to explain it. So I need to create a view like below in the image, which looks like a line chart.
In other words, the line thumbs should be interactive, so that user can move them up and down, which will led to the movement of "ropes" between each pair. The problem is I can not figure out to start what kind of structure in swift so that I can create this view. So far, I am thinking about to create separate sliders and connect them by drawing, lines between them, but I think there should be some better solution. Any help, idea, advice or hint is appreciated. Thanks in advance.
Part 1. Learning to use "drawRect" in a UIView
Make a custom view, i.e. subclass UIView. To draw the nine angled line segments (and indeed the grid behind) you'll need to master core graphics. Fortunately there are many of QA on this very topic:
How to draw a line in the simplest way in swift
Part 2. Custom layers in UIView
You'll have to learn about adding custom CALayers to views. There are many examples of this, eg
https://stackoverflow.com/a/57465440/294884
https://stackoverflow.com/a/41553784/294884
(Note that for the small text labels, I would probably simply add many UILabels programmatically, which you will also need to learn about.)
Part 3. Using UISlider
There's really nothing wrong with using a UISlider for each of your red dots. If you're just getting started with iOS, I suggest trying that first to become familiar with it.
A handy tip is, simply use a horizontal stack view to hold them all - you can space them as you wish.
Part 4. Using gestures
Beyond UISlider. The red buttons would most likely be custom UIViews. And, most simply, you would use UIPanGestureRecognizer to detect the finger moving.
Again you can find many QA on this field of study, example Move UIView within parent view using pangesture
If you master these four general fields you will be able to achieve the view in question, good luck!

How do i make View Controllers's Animation as like in Inshorts App but in horizontal direction

I'm working on an ios(Swift) project. In this project i want to read stories by fetching from a particular api.
But the problem is that i want only one story on my View and when i swipe right the another view with another story come from left with the effect that it is overlapping the story which is on the present view and so on until the story persist on the api.
And again when i swipe left, the most recent view(which was most recently get overlapped) with their respective story will come from right and give the effect like, it is overlapping the view which is present view at now.
And vice versa mentioned in above two points.
How can i achieve this in ios i don't. If anyone knows how to do it, please help me. I'm waiting for answers
NOTE: I don't want the pushing effect like in horizontal ScrollView. I only want the overlapping effect.
You should use 'UIPageViewController' and adjust 'transitionStyle' what you want.

iOS: Create a custom graph with content that changes at runtime

I'd like to create a graph with a lot of custom content and add information to this as the time elapses while the app runs.
The graph I have in mind will look similar to this:
The pink horizontal bar gets drawn as the time elapses.. as with the black value curve. The yellow vertical bar is linked to a specific event and I'd like to be able to draw more than one. Once the pink bar reaches the letter t then the first part of the graph will be overridden (<---- this is the direction of the overriding animation).
Any suggestion on how I can get this started? Any decent tutorial?
I'd like to do this in a custom UIView.
Any idea on which framework I should use in iOS? Is there a good tutorial for this?
I can advice to use CorePlot library.
It's flexible well-documented library that supports different kind of graphs.

Create vertical tabbar for ipad

Today I tried to implement a vertical tabbar for iPad. I checked a lot of questions on Stackoverflow and other sites but couldn't find the appropriate answer. Here are what I found:
https://github.com/futuresimple/FSVerticalTabBarController
https://github.com/nst/SEVerticalTabBar
https://github.com/NOUSguide/NGTabBarController
In my opinion, the third component is great. However, I guess I'll have to customize a lot before I can use to create this following UI:
So do you know any components/libraries that match my UI? It would be great if anyone can suggest me a correct one. Thanks.
Try to use FSVerticalTabBarController. I have used it and it is easy to modify...
You can try this component IIViewDeckController. Its very light weight.
Usually it will be used for Stackview, left Menu kind of UI.
But you can do a small trick like below to achieve your design above.
Steps:
The component have left, right, top, bottom and center stack of controllers.
Use a UITableView on your LeftViewController to design your above UI.
Each index will act as a container of OneViewController.
Clicking one cell of your tableview will place the appropriate ViewController in the center controller of IIViewDeckViewController.
Its very easy, I guess you will like it. Just take some time to go through their examples.
Hope it will be useful
I translated futuresimple/FSVerticalTabBarController into Swift 5.
My repo is https://github.com/coyingcat/VerticalTabBar
Apple's doc Implementing a Container View Controller is great also

What is the canonical way to animate views over a fixed background?

In my two recent questions here and here I laid out my problem a bit, but I want to ask a more general question here. First my goal: I am trying to animate views side to side with a fixed background image.
I am new to iOS, and so I don't know all the tools that are available to me, but each time I started hacking this together I kept thinking that there must be a built-in way to do this. I didn't want to reinvent the wheel, so what is the common way to implement this?
The best approach I think is making a UIView based in two main views:
The background, that always will stay
And on top of it, another UIView with your animated view
In case you want to animate it, its quite easy, just check this:
iPhone UIView Animation Best Practice

Resources