Getting a view's scale

Discussion in 'iOS Programming' started by fladnag, Oct 22, 2008.

  1. fladnag macrumors newbie

    Joined:
    Oct 3, 2008
    #1
    I want to read the scale of a view into a variable but I only know how to read a view's pixel size in. Like this:
    Code:
    int viewWidth = myView.frame.size.width;
    Can anyone tell me how to do it the other way, so that I can set a float with the view's scale - .90 or 2.50 or such?
    Code:
    float viewScale = myView. ??? scale??
     
  2. chbeer macrumors member

    chbeer

    Joined:
    Sep 22, 2008
    Location:
    Berlin
    #2
    Do you mean the scale set by a transform-matrix? If you mean that, it is possible to get the values by getting the transform-matrix and reading the appropriate fields. (I hope I remember correctly that there are 2 fields for scaling)
     
  3. lawicko macrumors member

    Joined:
    Jul 17, 2008
    #3
    Exactly, see CGAffineTransformMakeScale method in documentation to see which fields you need to read.
     
  4. fladnag thread starter macrumors newbie

    Joined:
    Oct 3, 2008
    #4
    Thanks for the help guys. I've got stuff working now.
     

Share This Page