site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=om9IMnanLNcXa7qVIqID+aSCO6xkJbIbl22B+7bUPiY=; b=csW4tj2kv5TIqESjc2SEDcY2CEbWvaQwweQINHKsmvVTJbMDqlrEmiLkYyqc7DQADG HJcBObBHL9h7Nmr8B6eI2Gui391IdZBj3AyQ9Qa59Qr/pcFp1OMSu0VJqcYvKeyj2sZB ae5C/4zrldSitr2SKsKJyvBX8UutDUCDLzeRBjZ34p3W4ahgxaggZe/4WKDG572zuX4W F1E+Skq9PQkZQR+drq9q8ddCu/5BvBWLki1pCc3ijNK/3ktJ1Bvarsrbwjf1IhU4Jmm3 ItmnLmsXOI4bmV29oof7z9glDS+VZTAhSQMAxnhAMXR31z4Jg7T+NjigH7rIf/WIGSLh S9uA== I have a currentValue (Int). I have a distance of the moved. For every 20 pixels, increment or decrement the currentValue by 1. If I do this: let tVal = Int(distanceValue / 20) if increment { currentValue = currentValue + tVal if currentValue > maxValue { currentValue = maxValue } } else { currentValue = currentValue - tVal if currentValue > maxValue { currentValue = maxValue } } Once the distance number gets high enough, I start to get tVal values of 2, 3, 4, etc. I think my logic is messed up here. On Tue, Sep 18, 2018 at 9:03 AM Richard Charles <rcharles346@gmail.com> wrote:
On Sep 18, 2018, at 6:44 AM, Eric E. Dolecki <edolecki@gmail.com> wrote:
I have a UI control that can be adjusted up and down using touch & drag. I've been asked to provide a control value based on how far the drag is via distance. So far so good.
What my designer wants is a value change of every 20 pixels or so (control is 150px tall @ the moment) - so every 20 pixels = a change of 1.
I think you mean points not pixels.
Not familiar with UI controls but this sounds very similiar to NSSlider.
– maxValue – minValue
– setMaxValue: – setMinValue:
This will require multiple touch and drags but he's fine with it.
This does not sound right. I think something is wrong.
--Richard Charles
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com