Re: UI to allow user to scale and crop image within a circle
Re: UI to allow user to scale and crop image within a circle
- Subject: Re: UI to allow user to scale and crop image within a circle
- From: Charles Jenkins <email@hidden>
- Date: Tue, 23 Feb 2016 07:28:24 -0500
Still struggling with this… My scrollview containing an imageview seems to work just fine: I can scale and crop an image with no problem. But I’m having difficulty getting the desired “crop circle” to hover over the scrollview properly. When I add it to the main view (not the scrollview) at runtime, I try using autolayout constraints to pin it to the left, top, right, and bottom of the scrollview; but it always appears positioned elsewhere, as if it’s not resizing due to the constraints.
I viewDidLoad(), I create each constraint like this:
let lc = NSLayoutConstraint( overlay, attribute: .Left, relatedBy: .Equal, toItem: scrollView, attribute: .Left, multiplier: 1, constant: 0 )
And when all four have been created, I call NSLayoutConstraint.activateConstraints( [ lc, tc, rc, bc ] )
Is this the wrong approach? What’s the right way to display a simple overlay above the content of a scrollView?
--
Charles
On February 21, 2016 at 20:48:18, Charles Jenkins (email@hidden) wrote:
I’m trying to do something that’s so simple, conceptually, that I’m sure there’s a demo program for it, if only I could find the right Google search to locate it.
I want to allow iOS users to select an image (either from the camera roll or by taking a photo) and display it in a CIRCLE for cropping. Users should be able to scale and position the image as they like to fit within the circle, then tap a DONE button to have the image cropped and saved into my app’s image store.
I spent all day today screwing around making a view controller with a scrollview containing an imageview, and I haven’t figured out how to make the circle overlay correctly to fit over the scrollview.
Does anybody know of a demo program that’ll show me how to do this?
--
Charles
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden