How to create resizable view with handlers on side

2019-03-04 16:15发布

This question already has an answer here:

I am creating an app where user touch the screen and places a rectangle view on screen which he can move or resize by touching its corners like any other crop view . I have done this functionality but i want eight handlers on the sides of that rectangle so that user can use that handlers to resize it. Now i am unable to create such functionality . I tried to add eight buttons as subview on that rectangle view but when resizing when that view increase its size than all eight buttons just change their positions . can anybody help me with this functionality ?

Thanks in advance

2条回答
\"骚年 ilove
2楼-- · 2019-03-04 17:00

Hi i got the answer from here . here is a great class for making resizable view. Great work by the developer

Create resizable view in ios with UITouch

查看更多
放荡不羁爱自由
3楼-- · 2019-03-04 17:10

To do this you are going the right way about it.

You need to create a custom view that positions these eight handles depending on the size of the view. When the view changes size you then need to reassess where those handles are so maybe have a function thats called when the view is resized and in here you change the location of each handle just by changing its x and y origin depending on the view size.

查看更多
登录 后发表回答