Home Ask Login Register

Developers Planet

Your answer is one click away!

Okadzaki Tomoe February 2016

Select part of GLKViewController

I'm try to implement this in my project. But I have some troubles with it. I plan to use UiPanGestureRecognizer for change size of rectangle. As I understand, I should be use UIVIew and custom drawRect method?


dzk February 2016

Add an action for your UIPanGestureRecognizer and use translation:

func wasDragged(gesture: UIPanGestureRecognizer) {
    let translation = gesture.translationInView(self.view)
    // Do your resizing here, e.g. from a 
    customView.frame.size.width = currentFrame.width + translation.x
    customView.frame.size.height = currentFrame.height + translation.y

    if gesture.state == .Ended {
        currentFrame = customView.frame

Using this method, add a CGRect variable to store the currentFrame.

Post Status

Asked in February 2016
Viewed 1,657 times
Voted 5
Answered 1 times


Leave an answer

Quote of the day: live life