Disabling pointers in Swift

How can I get the value of a variable into another variable without them having the same pointer? That is, in the code below, my keepScale value is getting updated to 1 when after recognizer.rotation is set to 1.

Code

var keepScale : CGFloat = 1 func handlePinch(recognizer : UIPinchGestureRecognizer) { if let view = recognizer.view { view.transform = CGAffineTransformScale(view.transform, recognizer.scale, recognizer.scale) keepScale = recognizer.scale println(keepScale) recognizer.scale = 1 println(keepScale) } }

Example Logs

0.5

1.0

-------------Problems Reply------------

Ok so actually since a scale is a ratio I had to multiply my keepScale value by recognizer.scale and not simply set it to equal.

Category:swift Views:0 Time:2018-09-13
Tags: pointers swift

Related post

  • How to disable pointers usage in JS? 2012-04-25

    Why is the result {"a":"b","c":1}? var foo = {"a":"b","c":0}; var bar = foo; bar.c++; alert(JSON.stringify(foo)); How to disable this behavior? --------------Solutions------------- What you're doing is making a second reference to an object but what

  • What is the recommended way to handle links that are used just for style and/or interactive purposes? 2010-11-04

    For example, the link below triggers something in jQuery but does not go to another page, I used this method a while back ago. <a class="trigger" href="#"> Click Me </a> Notice theres a just a hash tag there, and usually causes the page t

  • E2010 Incompatible Types, why? 2011-12-01

    I'm getting this error: [DCC Error] JwaStrSafe.pas(2277): E2010 Incompatible types: 'PSTRSAFE_LPWSTR' and 'PSTRSAFE_LPTSTR' The following is the relevant portion of code from JwaStrSafe.pas (from Jedi Api), I'm compiling with the symbol UNICODE defin

  • What is the worst problem that would occur if pointers were disabled in C++? 2010-11-05

    As the topic says - What is the biggest problem that would occur if we dropped usage of pointers and resorted to only references in C++? Let's say we have a new that returns a reference and a delete which takes one. --------------Solutions-----------

  • Disabling user input for UITextfield in swift 2016-01-05

    pretty trivial question, I know. But I can not find anything online. I need to disable the user from being able to edit the text inside of a text field. So that when the click on the text, a keyboard doesn't show up. Any ideas? A programmatic solutio

  • nhibernate - disable automatic\lazy loading of child records for one to many relationsihps 2008-10-20

    I would like to know if there is a way to disable automatic loading of child records in nHibernate ( for one:many relationships ). We can easily switch off lazy loading on properties but what I want is to disable any kind of automatic loading ( lazy

  • Should I delete or disable a row in a relational database? 2008-12-07

    In a brand new program where space isn't really that big a deal, is it better to delete a row or to disable a row by let's say a boolean "Disabled" and have the program just ignore it? For example, if I wanted to remove a user from a program. -------

  • Image map alt tags not visible when disabling images 2009-02-23

    Can anyone offer any pointers for making sure that the alt tags within an image map are visible when disabling images? I am using the FireFox Developer toolbar to Replace Images with Alt attributes. All images are replaced with the alt text that corr

  • Using Pointers in Delphi 2009-02-27

    I have been developing for some time now, and I have not used pointers in my development so far. So what are the benefits of pointers? Does an application run faster or uses fewer resources? Because I am sure that pointers are important, can you “poi

  • Enable/disable hardware w/o Admin rights on Vista? 2009-03-10

    I've been asked to provide a program/script/whatever that enables or disables the CD/DVD drive USB ports Floppy (!) drive devices without requiring admin rights, that is, that can be run by a 'normal' user. Ideally, something like a command line util

  • Casting away the const-ness in an array of pointers to const, and other questions regarding C 2009-04-20

    I have a bit of code I'm running to test multithreading in MATLAB mex functions (I know MATLAB isn't thread safe... I'm just playing around to see what happens). The entry point to MATLAB C code functions has the signature of the mexFunction function

  • When is safe to disable viewstate? 2009-05-14

    When is safe to disable viewstate? For wich controls? Under what circunstamces? In a user control I have disabled viewstate, but if I attempt to click in this control <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Delete" OnClientCli

  • Disable automatic DLL loading in C++ 2009-10-03

    My scenario is as follows: my application depends on a certain DLL (I use it's lib during linkage). However, when my application executes, I want to explicitly load that DLL using LoadLibrary. However, by default, when the code reaches a scope where

  • jQuery Disable/Enable status of Droppable/Draggable 2009-11-19

    I tired to explain this yesterday, but I don't think people understood it. I posted up the code and example at http://www.whatevercorp.com/problem/ I haven't worked with jQuery in a while, but have search everywhere for a disable('enable')/disable ex

  • Function Template Specialization on Function Pointers 2009-11-25

    I have a sanitization function that I want to run on (traditional) pointer types only. My problem is with function templates I can get as far as limiting the function to only pointers, however because of casting rule differences between function poin

  • c++ vector of class object pointers 2009-11-25

    What I am trying to do is essentially create two vectors of objects, where some objects are entered into both lists and some are just entered into one. The first problem I found was that when I used push_back() to add an object into both lists the ob

  • What's the point of having pointers in Go? 2009-12-07

    I know that pointers in Go allow mutation of a function's arguments, but wouldn't it have been simpler if they adopted just references (with appropriate const or mutable qualifiers). Now we have pointers and for some built-in types like maps and chan

  • Is there a use for uninitialized pointers in C or C++? 2009-12-15

    In one of the comments in this question, it was brought out that initializing C++ pointers by default would break compatibility with C. That's fine, but why would something like this matter? I would think the only time it would actually matter is if

  • Extract rules that disable a control 2010-02-09

    Background Weekly we will get some users calling out for help why thy can't do X on form Y. Because of complex business rules, we often have to revert looking in the code ourselves to know why that particular action is not available at that time. Are

  • UITableview: How to Disable Selection for Some Rows but Not Others 2010-02-15

    I am displaying in a group tableview contents parsed from XML. I want to disable the click event on it (I should not be able to click it at all) The table contains two groups. I want to disable selection for the first group only but not the second gr

  • Efficiency: arrays vs pointers 2010-02-21

    Memory access through pointers is said to be more efficient than memory access through an array. I am learning C and the above is stated in K&R. Specifically they say Any operation that can be achieved by array subscripting can also be done with

  • how to disable the screen on data load? 2010-03-29

    we are trying to show a loading image while the data is loading from the database. we are using AJAX calls for retrieving the data. Currently we are able to display that image. what we need now is to disable the entire screen and show only the loadin

  • Is it possible to temporarily disable Python's string interpolation? 2010-03-29

    I have a python logger set up, using python's logging module. I want to store the string I'm using with the logging Formatter object in a configuration file using the ConfigParser module. The format string is stored in a dictionary of settings in a s

  • database row/ record pointers 2010-04-11

    I don't know the correct words for what I'm trying to find out about and as such having a hard time googling. I want to know whether its possible with databases (technology independent but would be interested to hear whether its possible with Oracle,

  • How to disable word-wrap of NSTextView? 2010-07-04

    NSTextView does word-wrap by default. How can I disable this? I'm making a JSON code viewer, so I have to disable this. --------------Solutions------------- I got solution from: http://lists.apple.com/archives/cocoa-dev/2008/May/msg02396.html You hav

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.077 (s). 11 q(s)