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 8095571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:10:36+00:00 2026-06-05T21:10:36+00:00

I need a custom layer (extended by new variable and a method) and did

  • 0

I need a custom layer (extended by new variable and a method) and did it like below.
The problem is that the layer won’t respond to my method:

-[CALayer drawHourCircleWithDayLightStart:dayLightEnd:animated:]: unrecognized selector sent to instance 0x6a6d560**

It seems like my custom layer is not treated as HourCircleLayer but as CALayer.
But do I have to change here?

My implementation looks like this:

@interface HourCircleLayer : CALayer
   @property (strong) UIColor *dayColor;   // default yellowColor
   @property (strong) UIColor *nightColor; // default blueColor
   + (id)layer;
   - (void)drawHourCircleWithDayLightStart:(NSDate *)startDate dayLightEnd:(NSDate *)endDate animated:(BOOL)animated;
@end

@implementation HourCircleLayer
  + (id)layer
  {
     id layer = [CALayer layer];
     [layer setValue:[UIColor yellowColor] forKey:kDayPortionColorKey];
     [layer setValue:[UIColor blueColor]   forKey:kNightPortionColorKey];

     return layer;
  }

  - (void)drawHourCircleWithDayLightStart:(NSDate *)startDate dayLightEnd:(NSDate *)endDate animated:(BOOL)animated
  {
     self.withAnimation = animated;
     [self setDayLightStart:[self hourAngleForDate:startDate]];
     [self setDayLightEnd:[self hourAngleForDate:endDate]];
  }

@end
  • 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-06-05T21:10:38+00:00Added an answer on June 5, 2026 at 9:10 pm

    This is because you initialize CALayer, but not your HourCircleLayer. In your + (id)layer method change:

    id layer = [CALayer layer];
    

    to

    HourCircleLayer layer = [[HourCircleLayer alloc] init];
    ...
    
    return [layer autorelease]; //Use autorelease if not using ARC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a custom event that should raise if a new/existing file in a
I cannot find any equivalent binded method for CALayer's initWithLayer:(layer) selector that I can
I need to have custom checkboxes which wasn't that tricky. I made checkbox_selector to
I need to loop through the properties of a custom object type that I'm
I need create custom dialog and put JPanel into it. Is it possible?
I need a custom widget height. I tried using this Integer.toString(yourWidget.getElement().getOffsetHeight()) but, If I
I basically need a custom function to be used only when, for example, the
So I need some custom colors on a layout, but I'm looking for a
I'm trying to modify the Django Admin interface. I need a custom type of
I need to add custom validator for comparing two dates - start date and

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.