¡@

Home 

2014/10/15 ¤U¤È 10:13:48

iphone Programming Glossary: self.layer

Animating the drawing of a line

http://stackoverflow.com/questions/10603391/animating-the-drawing-of-a-line

nil self.frame.size.width 2 100.0 260 CGPathCloseSubpath path self.rootLayer CALayer layer rootLayer.frame self.bounds self.layer addSublayer rootLayer self.lineLayer CAShapeLayer layer lineLayer setPath path lineLayer setFillColor UIColor redColor .CGColor..

iOS Paper fold (origami / accordion) effect animation, with manual control

http://stackoverflow.com/questions/11157888/ios-paper-fold-origami-accordion-effect-animation-with-manual-control

self.frame.size.width 2 openAnimation.fillMode kCAFillModeForwards openAnimation setRemovedOnCompletion NO self.layer addAnimation openAnimation forKey @ position CATransaction commit The method grabs a CATransform Layer from this method..

Extract a part of UIImageView

http://stackoverflow.com/questions/14042260/extract-a-part-of-uiimageview

mainScreen .scale CGContextRef ctx UIGraphicsGetCurrentContext UIColor blackColor set CGContextFillRect ctx wholeRect self.layer renderInContext ctx UIImage image UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext return image @end..

Car (Annotation) animation (like uber app) not working

http://stackoverflow.com/questions/19268080/car-annotation-animation-like-uber-app-not-working

NSValue valueWithCGPoint toPos animation.duration 1.0 animation.delegate self animation.fillMode kCAFillModeForwards self.layer removeAllAnimations self.layer addAnimation animation forKey POSITIONKEY NSLog @ setPosition ANIMATED x from f f to f f.. animation.duration 1.0 animation.delegate self animation.fillMode kCAFillModeForwards self.layer removeAllAnimations self.layer addAnimation animation forKey POSITIONKEY NSLog @ setPosition ANIMATED x from f f to f f self self.center.x self.center.y.. NSValue valueWithCGPoint toPos animation.duration 0.8 animation.delegate self animation.fillMode kCAFillModeForwards self.layer removeAllAnimations self.layer addAnimation animation forKey POSITIONKEY NSLog @ setPosition ANIMATED x from f f to f f..

Get a PDF/PNG as output from a UIWebView or UIView

http://stackoverflow.com/questions/2454309/get-a-pdf-png-as-output-from-a-uiwebview-or-uiview

NULL CGPDFContextBeginPage ctx NULL CGContextScaleCTM ctx 1 1 CGContextTranslateCTM ctx 0 mediaBox.size.height self.layer renderInContext ctx CGPDFContextEndPage ctx CFRelease ctx @end Bad news UIWebView does not create nice shapes and text in..

Creating a Pop animation similar to the presentation of UIAlertView

http://stackoverflow.com/questions/2690775/creating-a-pop-animation-similar-to-the-presentation-of-uialertview

Getting a screenshot of a UIScrollView, including offscreen parts

http://stackoverflow.com/questions/3539717/getting-a-screenshot-of-a-uiscrollview-including-offscreen-parts

like this void takeScreenshot CGRect contextRect CGRectMake 0 0 768 1004 UIGraphicsBeginImageContext contextRect.size self.layer renderInContext UIGraphicsGetCurrentContext UIImage viewImage UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext..

Saving UIView contents in iOS 4 with real size of the images inside (i.e. scale contentes up for save)

http://stackoverflow.com/questions/4213529/saving-uiview-contents-in-ios-4-with-real-size-of-the-images-inside-i-e-scale

NULL UIGraphicsBeginImageContextWithOptions self.frame.size NO 0.0 else UIGraphicsBeginImageContext self.frame.size self.layer renderInContext UIGraphicsGetCurrentContext UIImage image UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext..

Why is my EAGLVIew not rendering anymore in iOS 4.2?

http://stackoverflow.com/questions/4270320/why-is-my-eaglview-not-rendering-anymore-in-ios-4-2

GL_RENDERBUFFER_OES _viewRenderbuffer _context renderbufferStorage GL_RENDERBUFFER_OES fromDrawable CAEAGLLayer self.layer glFramebufferRenderbufferOES GL_FRAMEBUFFER_OES GL_COLOR_ATTACHMENT0_OES GL_RENDERBUFFER_OES _viewRenderbuffer glGetRenderbufferParameterivOES..

Inner shadow effect on UIView layer?

http://stackoverflow.com/questions/4431292/inner-shadow-effect-on-uiview-layer

3.0f gradient.colors NSArray arrayWithObjects id RGB 130 0 140 CGColor id RGB 108 0 120 CGColor nil self.layer insertSublayer gradient atIndex 0 I'd like to add an inner shadow effect to it but I am not quite sure how to do this. I..

Core Animation CALayer mask animation performance

http://stackoverflow.com/questions/4520941/core-animation-calayer-mask-animation-performance

id symbolImage.CGImage maskLayer.shouldRasterize YES maskLayer.opaque YES fgLayer CALayer layer retain fgLayer.frame self.layer.frame fgLayer.backgroundColor UIColor colorWithImageNamed @ tabbar normal bg.png .CGColor fgLayer.mask maskLayer Apply the.. @ tabbar normal bg.png .CGColor fgLayer.mask maskLayer Apply the mask fgLayer.shouldRasterize YES fgLayer.opaque YES self.layer addSublayer fgLayer Note in the screenshot above you can see I've also added a shadow layer but for simplicity I removed..

UISegmentedControl text with multiple lines?

http://stackoverflow.com/questions/5614284/uisegmentedcontrol-text-with-multiple-lines

@implementation UIView LayerShot UIImage imageFromLayer UIGraphicsBeginImageContextWithOptions self.bounds.size NO 0 self.layer renderInContext UIGraphicsGetCurrentContext UIImage image UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext..

iOS icon jiggle algorithm

http://stackoverflow.com/questions/6604356/ios-icon-jiggle-algorithm

^ UIView setAnimationRepeatCount NSNotFound self.transform rightWobble completion nil void stopJiggling self.layer removeAllAnimations self.transform CGAffineTransformIdentity Credit where credit's due though @Vic320's answer provided..

Filling a portion of an image with color

http://stackoverflow.com/questions/8124308/filling-a-portion-of-an-image-with-color

colorspace kCGImageAlphaPremultipliedLast CGContextTranslateCTM context area.origin.x area.origin.y self.layer renderInContext context Seek through all pixels. float transparentPixels 0 for int i 0 i int areaFloat i 4 Count each transparent.. 3 1.0 255.0 0 transparentPixels 1 free bitmapData Calculate the percentage of transparent pixels. float hitTolerance self.layer valueForKey @ hitTolerance floatValue NSLog @ Apixels f hitPercent f transparentPixels transparentPixels areaFloat if transparentPixels..

Is there a way to figure out, how many degrees an view is rotated currently during an animation?

http://stackoverflow.com/questions/877198/is-there-a-way-to-figure-out-how-many-degrees-an-view-is-rotated-currently-duri

I am applying an rotation transform animation in an animation block with this transform CATransform3D rotatedTransform self.layer.transform rotatedTransform CATransform3DRotate rotatedTransform 90 M_PI 180.0 0.0f 0.0f 1.0f self.layer.transform rotatedTransform.. self.layer.transform rotatedTransform CATransform3DRotate rotatedTransform 90 M_PI 180.0 0.0f 0.0f 1.0f self.layer.transform rotatedTransform The animation begins and the user kicks in another event that would have to push the rotation.. I came across this answer while trying to find the current rotation angle during a key frame animation CALayer layer self.layer presentationLayer float currentAngle layer valueForKeyPath @ transform.rotation.z floatValue Seems to work for me. Also..

Record the drawing as a m4v video file - OpenGL

http://stackoverflow.com/questions/9661259/record-the-drawing-as-a-m4v-video-file-opengl

brushContext GLubyte brushData size_t width height if self super initWithCoder coder CAEAGLLayer eaglLayer CAEAGLLayer self.layer eaglLayer.opaque YES In this application we want to retain the EAGLDrawable contents after a call to presentRenderbuffer...