Hi every one there is a link :link and there is a sample code in it where the author use a CALayer with CAShapeLayer.What I would like is to use this CALayer like it was a uiimageView (maybe assign to a uiimageview) to be able to move it etc...
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Popover segue to static cell UITableView causes co
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- didBeginContact:(SKPhysicsContact *)contact not in
You cannot change the layer type of an existing
UIView
(meaning: you also can't change the layer of anUIImageView
), but drawing to a layer is pretty easy: you need to assign a delegate to yourCALayer
, and that delegate needs to implement drawLayer:inContext:.Another solution might be to create a
UIView
subclass and implement+layerClass
:That way your view will use a shape layer and you might be able to simply use the usual
UIView
'sdrawRect:
method. You could then access the layer via(CAShapeLayer *)[self layer]
to modify it. I haven't tried this approach, though.Edit: Explaining how the second solution would be done: