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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:32:58+00:00 2026-06-04T12:32:58+00:00

If a Single View app is created, with a FooView that subclasses UIView ,

  • 0

If a Single View app is created, with a FooView that subclasses UIView, and do a

NSLog(@"hello");

in drawRect, then it is printed.

And if I create a subclass of CALayer called CoolLayer, and add this method to FooView.m:

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

and at the end of FooView.m‘s drawRect, do a

NSLog(@"layer's class is %@", self.layer.class);

then CoolLayer is printed. So now the view’s underlaying layer is CoolLayer.

But when the following is added to CoolLayer.m:

-(void) display {

}

which is the method that is automatically called to redraw the layer (similar to drawRect), then no NSLog whatsoever was printed. It might be that the app went into an infinite loop. (even my touchesBegan that prints out NSLog messages is not printing). If a breakpoint is set at display, it will stop there once but when I continue the program, it will never arrive at display again. What is wrong with this and how can it be fixed?

  • 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-04T12:33:00+00:00Added an answer on June 4, 2026 at 12:33 pm

    The layer’s display method will not be called again unless the layer is dirty, i.e. set to need a redisplay. This is usually a good thing, and is why you don’t see the method being called more than once.

    Also, the normal implementation of display will call the drawInContext: method. Since you override this in your subclass, the drawRect: method of the view is never called. You need to either replicate the standard behavior of CALayer, or call the superclass’ display method in your own implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I create a brand new Single View Application iPhone app in Xcode 4.2, it
I have a project that I created by using Xcode's Single View Application template.
After we create a Single View App on Xcode 4.3.2, are there a couple
I just created a Xcode 4 Single View project (without storyboard), drag and drop
When i create new project with the name MyNewProject with a single view application
How do I create more than 40-50 textfields and labels in a single view
In OS3.1.3, I can create 6 UIWebView in a single view to watch 6
I have created a grid view that displays six cells of content. In each
I've created a simple rails app that has a people and a notes model.
I have just started my first CI app. I have a view that displays

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.