Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RutgerB

macrumors member
Original poster
Jul 13, 2008
32
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
 

kpua

macrumors 6502
Jul 25, 2006
294
0
If you're on Leopard, you can use the animator proxy like so:

Code:
[[minute22 animator] setFrameOrigin:NSMakePoint(100, 100)];
 

RutgerB

macrumors member
Original poster
Jul 13, 2008
32
1
I'm using Leopard but it doesn't do anything.
The textview just appears immediately at it's new position.
 

SRossi

macrumors regular
May 27, 2009
202
0
Glasgow, Scotland
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
 

RutgerB

macrumors member
Original poster
Jul 13, 2008
32
1
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

Thanks, this works :)

Additional question
How can I set a duration for the animation?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.