views:

28

answers:

1

I want to create an app which after each 1 second will show 4-5 words on screen but the last word will zoom out/in. I can easily create static words and for the last animating word i need to draw the static again n again. How can i create 2 separate layers so the static text is on one layer ( i will fill it after each second) and the last word (animated one) will be on other layer.

How to create 2 separate layers? Attached on same screen but handling their drawRect method separately?

+1  A: 

If I have understood your query then you should make your own class which will be subclass of UIView and override drawRect method in the implementation, then create 2 objects of your custom UIView class at the place where you are making layer's object. you can have x,y co-ordinate variables which will work separately for both layers....

Sanniv
any code for creating 2 objects of my custom UIView class and how to attach it to main window?
coure06
//MyView.h@interface MyUIView : UIView{ CGFloat wordX, wordY; NSString *word; //your animation specific variables}//MyUIView.m@implementation MyUIView-(void)drawRect { //Your animation code}//Usage in your view controller-(void) method{ MyUIView *firstWord = [[MyUIView alloc] init]; MyUIView *secondWord = [[MyUIView alloc] init]; [self.view addSubview:firstWord]; [self.view addSubview:secondWord];}
Sanniv