¡@

Home 

2014/10/15 ¤U¤È 10:10:59

iphone Programming Glossary: layer

Tricks for improving iPhone UITableView scrolling performance?

http://stackoverflow.com/questions/1352479/tricks-for-improving-iphone-uitableview-scrolling-performance

the standard accessibility functionality the content view's drawRect Make your UITableViewCell 's layer opaque same goes for the content view if you have one Use the reusableCellIdentifier functionality as..

Rounded UIView using CALayers - only some corners - How?

http://stackoverflow.com/questions/2264083/rounded-uiview-using-calayers-only-some-corners-how

NSData dataWithContentsOfURL NSURL URLWithString @ any Url Here CALayer l imgVUserImg layer l setMasksToBounds YES l setCornerRadius 5.0 l setBorderWidth 2.0 l setBorderColor UIColor darkGrayColor.. then How Thanks in advance for sharing your knowledge. Sagar. iphone objective c xcode uiview calayer share improve this question I used the answer over at How do I create a round cornered UILabel on..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

core animation share improve this question As Ben said you'll need to work with the UIView's layer using a CATransform3D to perform the layer's rotation. The trick to get perspective working as described.. As Ben said you'll need to work with the UIView's layer using a CATransform3D to perform the layer's rotation. The trick to get perspective working as described here is to directly access one of the.. You'll need to set this value to a negative fraction for your initial transform then apply your layer rotation transforms to that. You should also be able to do the following UIView myView self subviews..

Bold & Non-Bold Text In A Single UILabel?

http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel

string. #import QuartzCore QuartzCore.h #import CoreText CoreText.h Below example will add a sublayer to the toolbar of the navigation controller. la Mail.app in the iPhone. void setRefreshDate NSDate aDate.. aDate retain refreshDate release refreshDate aDate if refreshDate Create the text for the text layer NSDateFormatter df NSDateFormatter alloc init df setDateFormat @ MM dd yyyy hh mm NSString dateString.. nil NSString text NSString stringWithFormat @ @ @ prefix dateString df release Create the text layer on demand if _textLayer _textLayer CATextLayer alloc init _textLayer.font UIFont boldSystemFontOfSize..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

Im rendering 2 pages each side of the page in focus so that the PDF image is ready to mask the layer before it starts drawing.Pages are destroyed again when they are 2 pages away from the focused page... with nice transitions skim everything it seems PDF reader editor for OSX iphone ios ipad pdf calayer share improve this question I have build such kind of application using approximatively the same.. in advance in a separate thread. I don't overlay with a UIImage but instead draw the image in the layer when zooming is 1. Those tiles will be released automatically when memory warnings are issued. Whenever..

Inner shadow effect on UIView layer?

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

shadow effect on UIView layer I have the following CALayer CAGradientLayer gradient CAGradientLayer layer gradient.frame CGRectMake.. effect on UIView layer I have the following CALayer CAGradientLayer gradient CAGradientLayer layer gradient.frame CGRectMake 8 57 296 30 gradient.cornerRadius 3.0f gradient.colors NSArray arrayWithObjects.. 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..

iPhone UIView Animation Best Practice

http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice

setTimingFunction CAMediaTimingFunction functionWithName kCAMediaTimingFunctionEaseIn myview layer addAnimation applicationLoadViewIn forKey kCATransitionReveal but there are also code snippets floating..

Tricks for improving iPhone UITableView scrolling performance?

http://stackoverflow.com/questions/1352479/tricks-for-improving-iphone-uitableview-scrolling-performance

if possible avoid subviews at all costs or if you require the standard accessibility functionality the content view's drawRect Make your UITableViewCell 's layer opaque same goes for the content view if you have one Use the reusableCellIdentifier functionality as recommended by the UITableView examples documentation Avoid..

Rounded UIView using CALayers - only some corners - How?

http://stackoverflow.com/questions/2264083/rounded-uiview-using-calayers-only-some-corners-how

is a image view on IB. imgVUserImg.image UIImage imageWithData NSData dataWithContentsOfURL NSURL URLWithString @ any Url Here CALayer l imgVUserImg layer l setMasksToBounds YES l setCornerRadius 5.0 l setBorderWidth 2.0 l setBorderColor UIColor darkGrayColor CGColor Above code is applying the roundness to each of.. like top top left bottom right etc. Is it possible IF yes then How Thanks in advance for sharing your knowledge. Sagar. iphone objective c xcode uiview calayer share improve this question I used the answer over at How do I create a round cornered UILabel on the iPhone and the code from How is a rounded rect view with..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

snippets would be really appreciated iphone ios cocoa touch core animation share improve this question As Ben said you'll need to work with the UIView's layer using a CATransform3D to perform the layer's rotation. The trick to get perspective working as described here is to directly access one of the matrix cells of the.. ios cocoa touch core animation share improve this question As Ben said you'll need to work with the UIView's layer using a CATransform3D to perform the layer's rotation. The trick to get perspective working as described here is to directly access one of the matrix cells of the CATransform3D m34 . Matrix math has never.. thing so I can't explain exactly why this works but it does. You'll need to set this value to a negative fraction for your initial transform then apply your layer rotation transforms to that. You should also be able to do the following UIView myView self subviews objectAtIndex 0 CALayer layer myView.layer CATransform3D rotationAndPerspectiveTransform..

Bold & Non-Bold Text In A Single UILabel?

http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel

needed for CALayers and CoreText needed for the attributed string. #import QuartzCore QuartzCore.h #import CoreText CoreText.h Below example will add a sublayer to the toolbar of the navigation controller. la Mail.app in the iPhone. void setRefreshDate NSDate aDate aDate retain refreshDate release refreshDate aDate if refreshDate.. la Mail.app in the iPhone. void setRefreshDate NSDate aDate aDate retain refreshDate release refreshDate aDate if refreshDate Create the text for the text layer NSDateFormatter df NSDateFormatter alloc init df setDateFormat @ MM dd yyyy hh mm NSString dateString df stringFromDate refreshDate NSString prefix NSLocalizedString.. refreshDate NSString prefix NSLocalizedString @ Updated nil NSString text NSString stringWithFormat @ @ @ prefix dateString df release Create the text layer on demand if _textLayer _textLayer CATextLayer alloc init _textLayer.font UIFont boldSystemFontOfSize 13 .fontName not needed since `string` property will be..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

for just less than a second before a crisp version appears. Im rendering 2 pages each side of the page in focus so that the PDF image is ready to mask the layer before it starts drawing.Pages are destroyed again when they are 2 pages away from the focused page. Does anyone have any insights no matter how small or obvious.. zooming paging UIScrollView CATiledView brow leaves paging with nice transitions skim everything it seems PDF reader editor for OSX iphone ios ipad pdf calayer share improve this question I have build such kind of application using approximatively the same approach except I cache the generated image on the disk and.. image on the disk and always generate two to three images in advance in a separate thread. I don't overlay with a UIImage but instead draw the image in the layer when zooming is 1. Those tiles will be released automatically when memory warnings are issued. Whenever the user start zooming I acquire the CGPDFPage and render..

Inner shadow effect on UIView layer?

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

shadow effect on UIView layer I have the following CALayer CAGradientLayer gradient CAGradientLayer layer gradient.frame CGRectMake 8 57 296 30 gradient.cornerRadius 3.0f gradient.colors NSArray.. shadow effect on UIView layer I have the following CALayer CAGradientLayer gradient CAGradientLayer layer gradient.frame CGRectMake 8 57 296 30 gradient.cornerRadius 3.0f gradient.colors NSArray arrayWithObjects id RGB 130 0 140 CGColor id RGB 108 0 120 CGColor nil.. CGRectMake 8 57 296 30 gradient.cornerRadius 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 suppose I would be required to draw in..

iPhone UIView Animation Best Practice

http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice

setType kCATransitionReveal applicationLoadViewIn setTimingFunction CAMediaTimingFunction functionWithName kCAMediaTimingFunctionEaseIn myview layer addAnimation applicationLoadViewIn forKey kCATransitionReveal but there are also code snippets floating around the net that look like this UIView beginAnimations..

Tricks for improving iPhone UITableView scrolling performance?

http://stackoverflow.com/questions/1352479/tricks-for-improving-iphone-uitableview-scrolling-performance

or if you require the standard accessibility functionality the content view's drawRect Make your UITableViewCell 's layer opaque same goes for the content view if you have one Use the reusableCellIdentifier functionality as recommended by the..

Rounded UIView using CALayers - only some corners - How?

http://stackoverflow.com/questions/2264083/rounded-uiview-using-calayers-only-some-corners-how

UIImage imageWithData NSData dataWithContentsOfURL NSURL URLWithString @ any Url Here CALayer l imgVUserImg layer l setMasksToBounds YES l setCornerRadius 5.0 l setBorderWidth 2.0 l setBorderColor UIColor darkGrayColor CGColor Above code.. Is it possible IF yes then How Thanks in advance for sharing your knowledge. Sagar. iphone objective c xcode uiview calayer share improve this question I used the answer over at How do I create a round cornered UILabel on the iPhone and the..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

ios cocoa touch core animation share improve this question As Ben said you'll need to work with the UIView's layer using a CATransform3D to perform the layer's rotation. The trick to get perspective working as described here is to directly.. improve this question As Ben said you'll need to work with the UIView's layer using a CATransform3D to perform the layer's rotation. The trick to get perspective working as described here is to directly access one of the matrix cells of the.. works but it does. You'll need to set this value to a negative fraction for your initial transform then apply your layer rotation transforms to that. You should also be able to do the following UIView myView self subviews objectAtIndex 0 CALayer..

Bold & Non-Bold Text In A Single UILabel?

http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel

for the attributed string. #import QuartzCore QuartzCore.h #import CoreText CoreText.h Below example will add a sublayer to the toolbar of the navigation controller. la Mail.app in the iPhone. void setRefreshDate NSDate aDate aDate retain refreshDate.. NSDate aDate aDate retain refreshDate release refreshDate aDate if refreshDate Create the text for the text layer NSDateFormatter df NSDateFormatter alloc init df setDateFormat @ MM dd yyyy hh mm NSString dateString df stringFromDate.. @ Updated nil NSString text NSString stringWithFormat @ @ @ prefix dateString df release Create the text layer on demand if _textLayer _textLayer CATextLayer alloc init _textLayer.font UIFont boldSystemFontOfSize 13 .fontName not..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

crisp version appears. Im rendering 2 pages each side of the page in focus so that the PDF image is ready to mask the layer before it starts drawing.Pages are destroyed again when they are 2 pages away from the focused page. Does anyone have any.. brow leaves paging with nice transitions skim everything it seems PDF reader editor for OSX iphone ios ipad pdf calayer share improve this question I have build such kind of application using approximatively the same approach except I cache.. two to three images in advance in a separate thread. I don't overlay with a UIImage but instead draw the image in the layer when zooming is 1. Those tiles will be released automatically when memory warnings are issued. Whenever the user start zooming..

Inner shadow effect on UIView layer?

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

shadow effect on UIView layer I have the following CALayer CAGradientLayer gradient CAGradientLayer layer gradient.frame CGRectMake 8 57 296 30 gradient.cornerRadius.. shadow effect on UIView layer I have the following CALayer CAGradientLayer gradient CAGradientLayer layer gradient.frame CGRectMake 8 57 296 30 gradient.cornerRadius 3.0f gradient.colors NSArray arrayWithObjects id RGB 130 0 140.. 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..

iPhone UIView Animation Best Practice

http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice

applicationLoadViewIn setTimingFunction CAMediaTimingFunction functionWithName kCAMediaTimingFunctionEaseIn myview layer addAnimation applicationLoadViewIn forKey kCATransitionReveal but there are also code snippets floating around the net that..

SimpleAudioEngine, playing .caf files [duplicate]

http://stackoverflow.com/questions/10286686/simpleaudioengine-playing-caf-files

afconvert f AIFC d ima4 sound.wav and try to play them in Finder. If it doesn't work either try to convert the MPEG Layer 3 file to wave first by some third party tools such as Audacity and try again with afconvert . P.S. I usually use CAF for..

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

UIGraphicsEndImageContext set 3D depth CATransform3D transform CATransform3DIdentity transform.m34 1.0 800.0 CALayer origamiLayer CALayer layer origamiLayer.frame view.bounds origamiLayer.backgroundColor UIColor colorWithWhite 0.2 alpha.. set 3D depth CATransform3D transform CATransform3DIdentity transform.m34 1.0 800.0 CALayer origamiLayer CALayer layer origamiLayer.frame view.bounds origamiLayer.backgroundColor UIColor colorWithWhite 0.2 alpha 1 .CGColor origamiLayer.sublayerTransform.. set 3D depth CATransform3D transform CATransform3DIdentity transform.m34 1.0 800.0 CALayer origamiLayer CALayer layer origamiLayer.frame view.bounds origamiLayer.backgroundColor UIColor colorWithWhite 0.2 alpha 1 .CGColor origamiLayer.sublayerTransform..

OpenGL Layer on top of Video on iPhone?

http://stackoverflow.com/questions/1204664/opengl-layer-on-top-of-video-on-iphone

Layer on top of Video on iPhone I am trying to display a fullscreen video on the iPhone and overlay it with an OpenGL ES view...

Alpha transparent PNGs not displaying correctly in Mobile Safari

http://stackoverflow.com/questions/1374618/alpha-transparent-pngs-not-displaying-correctly-in-mobile-safari

my pages or PNGs Here's how I create the PNGs In Photoshop create a 1x1 transparent canvas. Draw a white rectangle in Layer 1. Set opacity to say 30 percent Save for Web as 24 bit PNG with transparency. iphone png transparency mobile safari ..

UITableView & UIScrollview stop cocos2d animations

http://stackoverflow.com/questions/15185720/uitableview-uiscrollview-stop-cocos2d-animations

UIScrollview stop cocos2d animations I have UITableView which is shown in front of my Layer ` CCDirector sharedDirector .view addSubview myTableView and takes some part of the screen. Everything works fine it detects..

Changing my CALayer's anchorPoint moves the view

http://stackoverflow.com/questions/1968017/changing-my-calayers-anchorpoint-moves-the-view

my CALayer's anchorPoint moves the view I want to alter the anchorPoint but keep the view in the same place. I've tried NSLog ing.. Type 11289 207 center point 272.500000 242.500000 iphone cocoa cocoa touch uiview share improve this question The Layer Geometry and Transforms section of the Core Animation Programming Guide explains the relationship between a CALayer's position.. Layer Geometry and Transforms section of the Core Animation Programming Guide explains the relationship between a CALayer's position and anchorPoint properties. Basically the position of a layer is specified in terms of the location of the layer's..

Rounded Corners on UIImage

http://stackoverflow.com/questions/205431/rounded-corners-on-uiimage

you just what you want UIImageView roundedView UIImageView alloc initWithImage UIImage imageNamed @ wood.jpg Get the Layer of any view CALayer l roundedView layer l setMasksToBounds YES l setCornerRadius 10.0 You can even add a border l setBorderWidth.. want UIImageView roundedView UIImageView alloc initWithImage UIImage imageNamed @ wood.jpg Get the Layer of any view CALayer l roundedView layer l setMasksToBounds YES l setCornerRadius 10.0 You can even add a border l setBorderWidth 4.0 l setBorderColor..

How to get objects to react to touches in Cocos2D?

http://stackoverflow.com/questions/2437010/how-to-get-objects-to-react-to-touches-in-cocos2d

Here is the header file When you import this file you import all the cocos2d classes #import cocos2d.h HelloWorld Layer @interface HelloWorld CCLayer CGRect spRect returns a Scene that contains the HelloWorld as the only child id scene @end.. you import this file you import all the cocos2d classes #import cocos2d.h HelloWorld Layer @interface HelloWorld CCLayer CGRect spRect returns a Scene that contains the HelloWorld as the only child id scene @end And here is the implementation.. the label on the center of the screen label.position ccp size.width 2 size.height 2 add the label as a child to this Layer self addChild label CCSprite sp CCSprite spriteWithFile @ test2.png sp.position ccp 300 200 self addChild sp float w sp..

Problem with cocos2D for iPhone and touch detection

http://stackoverflow.com/questions/377785/problem-with-cocos2d-for-iphone-and-touch-detection

hihi did I get it totally wrong Thank you iphone cocos2d iphone touch detection share improve this question Layer is the only cocos2d class which gets touches. The trick is that ALL instances of Layer get passed the touch events one after.. share improve this question Layer is the only cocos2d class which gets touches. The trick is that ALL instances of Layer get passed the touch events one after the other so your code has to handle this. I did it like this BOOL ccTouchesEnded..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

give the performance and functionality that you would expect from a good PDF viewer. You can draw a PDF page to a CALayer or to a UIImage . Apple even have sample code to show how draw a large PDF in a Zoomable UIScrollview But the same issues.. But the same issues keep cropping up. UIImage Method PDF's in a UIImage don't optically scale as well as a Layer approach. The CPU and memory hit on generating the UIImages from a PDFcontext limits prevents using it to create a real.. the UIImages from a PDFcontext limits prevents using it to create a real time render of new zoom levels. CATiledLayer Method Theres a significant Overhead time drawing a full PDF page to a CALayer individual tiles can be seen rendering even..

Mysterious “progressive slowing” problem in run loop / drawRect

http://stackoverflow.com/questions/4786754/mysterious-progressive-slowing-problem-in-run-loop-drawrect

drawRect Here's a real mystery. Imagine you are doing the conventional process of drawing a complex image offscreen CGLayer and you are updating the image on to the screen intermittently as you draw. As you know the way to do this is run the large.. strange behaviour from the OS. Later ... an astounding work around has been figured out by FELZ. Felz copies the CGLayer once each round. This completely stops the strange behaviour. However there is still no really clear understanding of what.. this one. Nice question and nice sample code. Here is my take on a possible answer The issue I see is the following. CGLayer are great for repeatedly painting because they cache their rendering into a flat image. The cache is invalidated when additional..

CoreAnimation, AVFoundation and ability to make Video export

http://stackoverflow.com/questions/5031721/coreanimation-avfoundation-and-ability-to-make-video-export

project provided by Apple but something seems not working on my project. Here my steps 1 I create the CoreAnimation Layer CALayer animationLayer CALayer layer animationLayer setFrame CGRectMake 0 0 1024 768 CALayer backgroundLayer CALayer layer.. provided by Apple but something seems not working on my project. Here my steps 1 I create the CoreAnimation Layer CALayer animationLayer CALayer layer animationLayer setFrame CGRectMake 0 0 1024 768 CALayer backgroundLayer CALayer layer backgroundLayer.. Apple but something seems not working on my project. Here my steps 1 I create the CoreAnimation Layer CALayer animationLayer CALayer layer animationLayer setFrame CGRectMake 0 0 1024 768 CALayer backgroundLayer CALayer layer backgroundLayer setFrame..

how we can show UIViewController and UIView by using cocos2d?

http://stackoverflow.com/questions/506680/how-we-can-show-uiviewcontroller-and-uiview-by-using-cocos2d

firstPieceView UIImageView secondPieceView @end @interface HelloController UIViewController @end @interface MenuLayer Layer Todo todo Menu menu sqlite3 database NSMutableArray todos NSString dirString CGPoint startTouchPosition @property.. firstPieceView UIImageView secondPieceView @end @interface HelloController UIViewController @end @interface MenuLayer Layer Todo todo Menu menu sqlite3 database NSMutableArray todos NSString dirString CGPoint startTouchPosition @property nonatomic.. button2 id sender void black_jack id sender @end but how can i show FlipView and HelloController classe through MenuLayer class. iphone objective c cocos2d share improve this question If you are asking how to attach UIKit views and such..

Create layer mask with custom-shaped hole

http://stackoverflow.com/questions/5721196/create-layer-mask-with-custom-shaped-hole

image is represented by a CCSprite. It shouldn't matter though if no cocos is used. Problem I've tried using CAShapeLayer and bitmaps as masks but nothing is working see code snippets below . With the CAShapeLayer I create a UIBezierPath for.. I've tried using CAShapeLayer and bitmaps as masks but nothing is working see code snippets below . With the CAShapeLayer I create a UIBezierPath for the 'hole' and apply it to the colored layer. However only the hole shows the color while the.. actual mask working first. The sample code is ignoring the y axis differences between iPhone SDK and openGL. CAShapeLayer Example CGSize winSize CCDirector sharedDirector winSize UIImage img UIImage imageNamed @ zebra.png CCSprite spr CCSprite..

How to set round corners in UI images in iphone

http://stackoverflow.com/questions/5752667/how-to-set-round-corners-in-ui-images-in-iphone

How to draw a line with Cocos2d-iPhone

http://stackoverflow.com/questions/691648/how-to-draw-a-line-with-cocos2d-iphone

Cocos2d by trying to accomplish simple things. At this point I have a scene that scene has a background sprite and a Layer. I'm trying to draw onto the Layer uding drawLine. Here's by current attempt. @implementation MyLayer id init self super.. things. At this point I have a scene that scene has a background sprite and a Layer. I'm trying to draw onto the Layer uding drawLine. Here's by current attempt. @implementation MyLayer id init self super init if self nil glColor4f 0.8 1.0.. sprite and a Layer. I'm trying to draw onto the Layer uding drawLine. Here's by current attempt. @implementation MyLayer id init self super init if self nil glColor4f 0.8 1.0 0.76 1.0 glLineWidth 2.0f CocosNode line drawLine 10.0f 100.0f 400.0f..