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

  • Home
  • SEARCH
  • 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 912769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:26:29+00:00 2026-05-15T17:26:29+00:00

I have a superview and a subview. Both are custom. During the drawRect of

  • 0

I have a superview and a subview. Both are custom. During the drawRect of the superview, I am trying to add the subview, create an image from the drawn view, and remove the subview.

My code works fine when I run it and start with the subview already drawn in the superview. It seems like adding the subview (during the drawRect) doesnt draw it immediately, it has to wait for the next drawRect.

How do I add a subview and force it to draw immediately?

  • 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-15T17:26:31+00:00Added an answer on May 15, 2026 at 5:26 pm

    First, if you find yourself forcing a display, you’re almost certainly doing something wrong.

    Second, you shouldn’t be adding subviews during drawRect, which is meant mostly to draw the view’s current State.

    Third, what are you actually trying to do? The broad, dumbed down description, please. It seems to me you’re having a problem with the basic approach to your goal, so if you describe it beyond the very narrow focus of what isn’t working for you, we might be able to suggest a better (and perhaps easier) solution.

    Finally, in direct answer to your question, just tell the view to -display if you want it to display immediately … but I don’t think it’s going to behave the way you’re expecting it to.

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

Sidebar

Related Questions

I have a UITableView which is a read-only, no-scrolling view. It's a subview of
I am trying to remove two viewcontrollers (that have been added on top of
I have 2 subclasses of NSView that are subviews to a common superview. They
i have a UIView that is smaller than the superview so i can represent
I have a UIViewController subclass whose view is configured in a NIB file. The
I have a couple of custom NSBox subclasses called OuterBox and InnerBox. I've set
Ok, basically I have a view with a series of slightly overlapping subviews. When
here's a problem with memory management issue. Say i have a view A, it
I have an object that is a subclass of UIView that can be added
I am bit stack with creating two UIViews which are switchable (each UIView has

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.