Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6877915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:39:32+00:00 2026-05-27T04:39:32+00:00

Hi every one there is a link : link and there is a sample

  • 0

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…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:39:32+00:00Added an answer on May 27, 2026 at 4:39 am

    You cannot change the layer type of an existing UIView (meaning: you also can’t change the layer of an UIImageView), but drawing to a layer is pretty easy: you need to assign a delegate to your CALayer, and that delegate needs to implement drawLayer:inContext:.

    Another solution might be to create a UIView subclass and implement +layerClass:

    + (Class)layerClass
    {
        return [CAShapeLayer class];
    }
    

    That way your view will use a shape layer and you might be able to simply use the usual UIView‘s drawRect: 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:

    @interface MyView : UIView {
        UIImage *image;
    }
    @property(retain) UIImage *image;
    @end
    
    
    @implementation MyView
    @synthesize image;
    
    + (Class)layerClass
    {
        return [CAShapeLayer class];
    }
    
    - (void)dealloc
    {
        self.image = nil;
        [super dealloc];
    }
    
    - (void)drawRect:(CGRect)rect
    {
        // Draw the image. You might need to play around with this,
        // for example to draw the image as aspect fit or aspect fill.
        [image drawInRect:rect];
    }
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In virtually every project I've ever worked on, there will be one or two
Thanks to everyone out there helping newbies like me. So far I have this:
Given a string like this: <a href=http://blah.com/foo/blah>This is the foo link</a> ... and a
While implementing the code from this question on my project I realized there's 3
Hi every one I have these classe @Entity @Table(name = login, uniqueConstraints={@UniqueConstraint(columnNames={username_fk})}) public class
Does everyone just use XML in the message? Are there any good alternatives to
It seems to me like there's a lot of sheeping going on, with everyone
every one i m new with ASP .net and I dont know how to
There is a link in my webpage, the link itself triggers a function that
I am trying to scrape form field IDs using Beautiful Soup like this for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.