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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:37:54+00:00 2026-05-31T13:37:54+00:00

Here is my drawRect : – (void)drawRect:(CGRect)rect { CGContextFillEllipseInRect(UIGraphicsGetCurrentContext(), self.bounds); } and the instances

  • 0

Here is my drawRect:

- (void)drawRect:(CGRect)rect
{
    CGContextFillEllipseInRect(UIGraphicsGetCurrentContext(), self.bounds);
}

and the instances of this class are added a subviews the next way:

(#define DOTS_SIZE 30)

[self addSubview:[[VertexView alloc] initWithFrame:CGRectMake(anchor.x-DOTS_SIZE/2, anchor.y-DOTS_SIZE/2, DOTS_SIZE, DOTS_SIZE)]];

As far as I understand, I should get and ellipse (circle my case) in the views bounds. But I get it fully filled with rectangle (square).

By the way, I have logged bounds and their size is 30×30, so I should get nice little circles, but I get squares (T_T)

I’ll be thankful for any advise!

  • 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-31T13:37:55+00:00Added an answer on May 31, 2026 at 1:37 pm

    The problem is that you have to make some setup before drawing the ellipse. For example:

    - (void)drawRect:(CGRect)rect
    {
        CGContextRef ctx = UIGraphicsGetCurrentContext();
        CGContextSetFillColorWithColor(ctx, [UIColor redColor].CGColor); // Or any other color.
        CGContextFillEllipseInRect(ctx, self.bounds);
    }
    

    And to make background transparent you can check out: Setting A CGContext Transparent Background

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

Sidebar

Related Questions

- (void)drawRect:(CGRect)rect { CGContextRef s = UIGraphicsGetCurrentContext(); CGContextSetRGBFillColor(s, 250, 5, 5, 1); CGContextFillRect(s, CGRectMake(2,
I used custom navigation bar within my application, // appdelegate.h @implementation UINavigationBar(customNavBar) - (void)drawRect:(CGRect)rect{
Here's My Code: - (void)drawRect:(NSRect)dirtyRect { // Drawing code here. // Create the Gradient
hi i have this really basic class here .. and i want to use
Here's a coding problem for those that like this kind of thing. Let's see
Must I also do all this crazy coordinate system conversion stuff here, or is
I have this code in my drawRect method float aValue = .0167f; float fValue
I have a a singleton class here is the code #import <Foundation/Foundation.h> #import CustomColor.h
Here's a very simple AS3 project consisting of one class which draws a rectangle.
i know that this question looks the same as other around here, but none

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.