Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a pull up view in iOS [closed]

Dear Fellow Developers,

How would I (or you) go about creating a view that can be slid up, like Apple has done in the new iOS 12 Stocks app? I've been searching if there's native support for this but haven't found it yet. If you haven't used it, it's a News view that can be pulled up in front of the stocks information and it has its own content. It can naturally be also pushed down again.

I would prefer to use Apple's implementations if they exist instead of 3rd party.

Most of the similar questions were at least 5 years old so I'm wondering what the current options are.

Answer: I followed the instructions of the accepted answer created my own implementation:

  1. Create a view that should get raised up
  2. Create another view as top slice of view number 1 to be the place where you grab the view
  3. Add a PanGestureRecognizer and hook it up to the view number 2
  4. Create view number 3 in view number 2 to be the small icon as seen in the stock app view
  5. Add rounding of corners and shadowing to view number 1

Stocks image

Ready implementation.

like image 307
OwlOCR Avatar asked Oct 25 '25 00:10

OwlOCR


1 Answers

Update: For iOS15 and above, Apple has introduced UISheetPresentationController. Have a look!

Well I am not acquainted with the iOS 12 Stocks app. But here's how you can do it.

Create a view that recognizes pan gesture. Track the pan gesture and update the the origin y of the view that slides up accordingly.

like image 147
iOSer Avatar answered Oct 26 '25 15:10

iOSer