calayer

NSViewController. Core Animation sublayer not drawing.

Hi, I create NSViewController. It manage my view hierarchy and set other views in one NSBox. - (void)displayViewController:(ManagingViewController *)vc { NSWindow *w = [box window]; NSView *v = [vc view]; [box setContentView:v]; } I have two alternate views. The views have Quartz Composer root layer and CALayer sublayer. // ...

Need help to make my iPhone animation work?

I'm brand new in iPhone animation feature. I wrote a simple testing program to spin a red rectangle; however, the animation doesn't act at all. What's wrong with my code? Thanks a lot... //.h #import <UIKit/UIKit.h> #import <QuartzCore/QuartzCore.h> #define DegreesToRadians(X) (M_PI*X/180.0) //.m - (void)viewDidLoad { [super viewD...

Heeelp! Debugger says "out of scope"!

I just cannot imagine what the hell the problem could be. I made a pretty app, and decided to use only CALayers to "render". When I saw that the changes in the position property gets animated, decided to implement a custom getter-setter "abstract" property called tanCenter to set the position without animating. -(void) setTanCenter: (C...

How to distort a Sprite into a trapezoid?

Hello, I am trying to transform a Sprite into a trapezoid, I don't really care about the interpolation even though I know without it my image will lose detail. All I really want to do is Transform my rectangular Sprite into a trapezoid like this: / \ / \ /__________\ Has anyone done this with CGAffineTransforms or...

Make a "Merged copy" of a CALayer composition.

I know it has answered here, but I cannot get it work. I have some puzzlePiece CALayer subclass instance, each with 4 additional sublayer. When user manupulates a piece, its sublayers get changed. But after manipulating finished, user can only move these pieces. I want to make somehow a "snapshot" of the sublayers after user finished m...

Why does one have to use CALayer's presentationLayer for hit-testing?

I was working on a Cocoa Touch application, and trying to handle touches by determining which sublayer of a view's layer was touched. My controller's code looked like this: CALayer *hitLayer = [self.view.layer hitTest:point]; This wasn't working. It would work if I tapped at the bottoms of sublayers, but not at the tops. After an hour...

Simple example of CALayer usage -- perhaps in a UITextField

Hi, I have an requirement to implement a custom keyboard for a Cocoa Touch data entry screen containing multiple UITextFields. I've built the keyboard, and everything is working except now I need to figure out how to implement a blinking cursor. (When you disable the UITextField's built-in keyboard, you lose the cursor as well). In googl...

Disabling implicit animations in -[CALayer setNeedsDisplayInRect:]

I've got a layer with some complex drawing code in its -drawInContext: method. I'm trying to minimize the amount of drawing I need to do, so I'm using -setNeedsDisplayInRect: to update just the changed parts. This is working splendidly. However, when the graphics system updates my layer, it's transitioning from the old to the new image u...

Rounded UIView using CALayers - only some corners - How?

Hello ! every one. In my application - there are four buttons named as follows. Top - left Bottom - left Top - right Bottom - right Above this buttons there is an image view / or we can use also UIView. Now, suppose user taps on - top - left button. Above image / view should be rounded from that particular corner. I am having som...

Masking a CALayer - iPhone

I'm creating a custom on / off toggle switch for the iPhone (similar to the standard switch) and i'm at the point where I'm setting the mask of the slider, but calling [[myView layer] setMask:maskLayer] sets the position of the mask layer relative to the layer it's masking, not relative to the container layer of the mask layer. For this...

UIScrollView and CALayers

I have a custom UIView that is composed entirely of CALayers. In the awakeFromNib method it creates and sets all the CALayers into their appropriate positions (CAGradientLayer, several CATextLayers, and a few custom CALayer subclasses). The custom UIView does not override the drawRect: method because there's no drawing done directly int...

iPhone animationDidStop Identifier CAAnimation

Somehow it doesn't matter which key I provide for the addAnimation method the key will always become 'transition' and there for I can't add more the one animation. Is there a logical explanation for this? CATransition *animation = [CATransition animation]; animation.delegate = self; animation.duration = 2.0; anima...

Changing the text of a UILabel when its superview is being animated.

Is it possible to alter the text of a UILabel whist its superview is being animated by UIView animations? Say I have labelView as a sub view of containerView. timerFired is being called during containerView being animated (never before or after). I'm calling setText of labelView during the animation, but its text doesn't change. Is ther...

How to replace the custom animation for a CALayer appearing

I have a CALayer that I want to change the custom animation for it appearing on screen. I have created a delegate so that I can catch the method: - (id < CAAction >)actionForLayer:(CALayer *)layer forKey:(NSString *)key And I check for the key to be equal to kCAOnOrderIn, however, the layer hasn't been told what it's bounds will be ye...

CALayer and obtaining currentcontext of its UIView

I try to learn the drawing process in UIView in iphone. as I understand the drawing process accurs only if the method [UIView drawRect] exists. it starts with [CALayer display] and from within that method [UIView drawRect] is called (to be precise :first [UIView drawLayer:layer inContext:context] is called and from within this method ...

visibility (overlapping) problems with CABasicAnimation CALayer transformations

I have two UIImageViews on my object, and I'm trying to animate them to page like a book. I used some of the built in animations for a while (UIViewAnimationTransitionFlipFromLeft/Right), and decided I could do better. I found a nice example for half of the animation I wanted here: http://fiftysixtysoftware.com/blog/2009/uiview-pageopen-...

what is the context passed into drawLayer:inContext:?

In Iphone development, I want to draw context in layer. Then the question is: What exactly is the context passed into drawLayer:inContext:? Is it the layer's contents's context or the UIview's context? If this is the UIView's context, which UIView it is? Thanks in advance. ...

[CALayer retainCount] sent to deallocated instance

Whenever I push a view controller onto my stack, then pop it off, I get this error: *** -[CALayer retainCount]: message sent to deallocated instance <memory address> It seems to happen right after dealloc is called on the view controller that is being popped off and is exclusive to only this view controller. I'm sure the CALayer has s...

UIScrollView zoomToRect not zooming to given rect (created from UITouch CGPoint)

My application has a UIScrollView with one subview. The subview is an extended UIView which prints a PDF page to itself using layers in the drawLayer event. Zooming using the built in pinching works great. setZoomScale also works as expected. I have been struggling with the zoomToRect function. I found an example online which makes a C...

Blind down animation on CALayer using a mask

Hi there, I want to create a "blind down" effect on an image so the image "blinds down" and appears. Sort of like this JavaScript transition: http://wiki.github.com/madrobby/scriptaculous/effect-blinddown The mask is setup correctly because if I manually change it's position it hides and reveals the image behind it, but it doesn't ani...