Animating a textview

Discussion in 'Mac Programming' started by RutgerB, Aug 26, 2009.

  1. RutgerB macrumors newbie

    Joined:
    Jul 13, 2008
    #1
    Hi


    In my application I have a textview (called minute22). I use this code to change it's frame:
    Code:
    [minute22 setFrame:NSMakeRect(100,100,200,200)];//Just some random values
    What I want to do is to move the textview animated. The x and y view should change animated.(the width and height can stay the same)


    Thanks for helping me

    Rutger
     
  2. kpua macrumors 6502

    Joined:
    Jul 25, 2006
    #2
    If you're on Leopard, you can use the animator proxy like so:

    Code:
    [[minute22 animator] setFrameOrigin:NSMakePoint(100, 100)];
    
     
  3. RutgerB thread starter macrumors newbie

    Joined:
    Jul 13, 2008
    #3
    I'm using Leopard but it doesn't do anything.
    The textview just appears immediately at it's new position.
     
  4. GorillaPaws macrumors 6502a

    GorillaPaws

    Joined:
    Oct 26, 2003
    Location:
    Richmond, VA
    #4
    What about embedding your text view inside a parent view and animating the parent view with the animator proxy?
     
  5. SRossi macrumors regular

    Joined:
    May 27, 2009
    Location:
    Glasgow, Scotland
    #5
    Personally I would do it like:

    Code:
    newFramePosition = NSMakeRect(0.0f, 0.0f, 100.f, 
                                     100.0f);   // Random sizes
    
    [[minute22 animator] setFrame:newFramePosition];
    Think this should work as it is used a bit differently in Core Animation for Mac OSX by Bill Dudley. But basically the idea should be the same.

    Stephen
     
  6. RutgerB thread starter macrumors newbie

    Joined:
    Jul 13, 2008
    #6
    Thanks, this works :)

    Additional question
    How can I set a duration for the animation?
     

Share This Page