Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to scale SVGView #426

Closed
LeChatNoir69 opened this issue Jun 17, 2018 · 4 comments
Closed

How to scale SVGView #426

LeChatNoir69 opened this issue Jun 17, 2018 · 4 comments
Assignees
Milestone

Comments

@LeChatNoir69
Copy link

LeChatNoir69 commented Jun 17, 2018

Hi,

Here is the explanation :
=> Got an UIScrollview with fixed Height
=> Got a jpg picture in that scrollview. I compute ratio so the picture fit in height and user can scroll horizontaly to view the all width
=> Got a SVGView over it with same size. ContentMode = ScaleToFill.

Unfortunately, the svg inside is not correctly scaled.

Does I have to scale it manually ? How ?

Here is the code for UIImageView sizing :

        let viewHeight = self.graphicSv.bounds.size.height
        let imageWidth = (cragImage?.size.width)! / (cragImage?.size.height)! * viewHeight
        self.cragPictureWidth.constant = imageWidth
        self.cragPictureHeight.constant = viewHeight
@008v
Copy link

008v commented Jun 19, 2018

scrollView.addSubview(imgView)
scrollView.contentSize = imgView.bounds.size

@ystrot ystrot added this to the 0.9.3 milestone Jun 28, 2018
@008v
Copy link

008v commented Jun 28, 2018

You can add a dummy view for scrollView. And the color of dummy view is clear color. You could get the contentOffset and scale in scrollViewDidScroll method. So you could change node.place of MacawView to scale or move it.

@008v
Copy link

008v commented Jun 28, 2018

Never try to change the frame size of MacawView to get a clear image. Memory will warn.

@ystrot ystrot modified the milestones: 0.9.3, 0.9.4 Oct 2, 2018
@ystrot ystrot modified the milestones: 0.9.4, 0.9.5 Feb 26, 2019
@ystrot ystrot modified the milestones: 0.9.5, 0.9.6 Apr 4, 2019
@ystrot ystrot modified the milestones: 0.9.6, 0.9.7 Apr 10, 2020
@ystrot ystrot self-assigned this Jul 28, 2020
@ystrot
Copy link
Member

ystrot commented Jul 28, 2020

Shouldn't be an issue anymore, so closing it.

@ystrot ystrot closed this as completed Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants