Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MHayez

macrumors newbie
Original poster
Jun 15, 2016
1
0
As you can see in the pictures I attached the app has 2 frames that can be dragged up and down and have curved edges at the top. How could I go about doing something similar to this in my app. What would i need to learn how to code to get this effect?

If you need more detail into what i'm talking about, ask me any questions. Any help or direction would greatly help me
 

Attachments

  • IMG_9764.PNG
    IMG_9764.PNG
    71.7 KB · Views: 164
  • IMG_9765.PNG
    IMG_9765.PNG
    63.6 KB · Views: 154
  • IMG_9766.PNG
    IMG_9766.PNG
    55.7 KB · Views: 166

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
The rounded corners are made by setting view.layer.cornerRadius = 10 (or a similar value). The images show only the top corners as rounded. I'll leave that up to you to figure out how to do that.

Code:
view.layer.cornerRadius = 10
view.layer.masksToBounds = true

Adjusting the size or position of a view in response to a finger drag is a matter of using a gesture recognizer to track the finger and then adjusting the view's frame in the gesture recognizer's callback method. I think you need a UIPanGestureRecognizer. You could set view.frame but these days you're probably using constraints. You'll need an IBOutlet to the top constraints for your views and you'll need to set the constant property to force the view to update its frame. I think you're expecting the back view to never be completely hidden by the front view so you'll need to adjust the height of both views when the front view gets to a certain height.

Thanks for asking.
 
  • Like
Reactions: bozokelly

bozokelly

macrumors newbie
Jun 14, 2016
16
10
Perth
The rounded corners are made by setting view.layer.cornerRadius = 10 (or a similar value). The images show only the top corners as rounded. I'll leave that up to you to figure out how to do that.

Code:
view.layer.cornerRadius = 10
view.layer.masksToBounds = true

Adjusting the size or position of a view in response to a finger drag is a matter of using a gesture recognizer to track the finger and then adjusting the view's frame in the gesture recognizer's callback method. I think you need a UIPanGestureRecognizer. You could set view.frame but these days you're probably using constraints. You'll need an IBOutlet to the top constraints for your views and you'll need to set the constant property to force the view to update its frame. I think you're expecting the back view to never be completely hidden by the front view so you'll need to adjust the height of both views when the front view gets to a certain height.

Thanks for asking.

I've just started coding and learning about app development, man there is SO MUCH to learn. Loving it though. :)
 

AxoNeuron

macrumors 65816
Apr 22, 2012
1,251
855
The Left Coast
The rounded corners are made by setting view.layer.cornerRadius = 10 (or a similar value). The images show only the top corners as rounded. I'll leave that up to you to figure out how to do that.

Code:
view.layer.cornerRadius = 10
view.layer.masksToBounds = true

Adjusting the size or position of a view in response to a finger drag is a matter of using a gesture recognizer to track the finger and then adjusting the view's frame in the gesture recognizer's callback method. I think you need a UIPanGestureRecognizer. You could set view.frame but these days you're probably using constraints. You'll need an IBOutlet to the top constraints for your views and you'll need to set the constant property to force the view to update its frame. I think you're expecting the back view to never be completely hidden by the front view so you'll need to adjust the height of both views when the front view gets to a certain height.

Thanks for asking.
That's interesting. I always set 'clipsToBounds', not 'masksToBounds'. I wonder what the difference is.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.