iOS - Resize multiple views with touch-drag separators

前端 未结 5 2024
暗喜
暗喜 2021-01-01 04:20

How can I resize views with a separator? What I\'m trying to do is something like Instagram layout app. I want to be able to resize views by dragging the line that separates

5条回答
  •  北海茫月
    2021-01-01 04:39

    As per my best knowledge we can do this using UIGestureRecognizer and auto layout.

    1. Use UIView as line separator.
    2. Add Pan gestureRecognizer to separator line view.
    3. Handle view movement in delegate protocol methods using UIView.animatewithDuration()
    PanGestureRecognizer

    Most important, don't forget to set/Check UserInteration Enabled for all line separator view in Attribute Inspector.

提交回复
热议问题