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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:17:45+00:00 2026-06-13T04:17:45+00:00

I want to add a custom UIView that contains an CABasicAnimation to a UITableViewCell.

  • 0

I want to add a custom UIView that contains an CABasicAnimation to a UITableViewCell. I do this the following way

if( self.pie_chart_view == nil )
    self.pie_chart_view = [[PieChartView alloc] initWithFrame:CGRectMake( 0.f, 0.f, 30.f, 30.f )];
[pie_chart_view animate_progress_from:0.0 to:1.0 with_duration:5.0];
[cell.contentView addSubview:pie_chart_view];

But the code crashes as the following screenshot demonstrates:

enter image description here

The crash apparently is caused in the following piece of code

- (void)drawInContext:(CGContextRef)context {
CGRect circleRect = CGRectInset(self.bounds, 1, 1);

CGColorRef borderColor = [[UIColor whiteColor] CGColor];
CGColorRef backgroundColor = [[UIColor colorWithWhite:0 alpha: 0.75] CGColor];

CGContextSetFillColorWithColor(context, backgroundColor); <--- CRASHES ON THIS LINE WITH EXC_BAD_ACCESS
CGContextSetStrokeColorWithColor(context, borderColor);
CGContextSetLineWidth(context, 2.0f);

CGContextFillEllipseInRect(context, circleRect);
CGContextStrokeEllipseInRect(context, circleRect);

CGFloat radius = MIN(CGRectGetMidX(circleRect), CGRectGetMidY(circleRect));
CGPoint center = CGPointMake(radius, CGRectGetMidY(circleRect));
CGFloat startAngle = -M_PI / 2;
CGFloat endAngle = self.progress * 2 * M_PI + startAngle;
CGContextSetFillColorWithColor(context, borderColor);
CGContextMoveToPoint(context, center.x, center.y);
CGContextAddArc(context, center.x, center.y, radius, startAngle, endAngle, 0);
CGContextClosePath(context);
CGContextFillPath(context);

[super drawInContext:context];
}

But I do not see why it should crash. My project uses ARC. What am I missing here?

  • 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-13T04:17:46+00:00Added an answer on June 13, 2026 at 4:17 am

    Okay, I solved the problem. When using ARC the UIColor is deleted immediatly. One can repair this by doing the following:

    UIColor * __autoreleasing borderColor = [UIColor whiteColor];
    UIColor * __autoreleasing backgroundColor = [UIColor colorWithWhite:0 alpha: 0.75];
    
    CGContextSetFillColorWithColor(context, backgroundColor.CGColor );
    CGContextSetStrokeColorWithColor(context, borderColor.CGColor );
    

    After that the code no longer crashes.

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

Sidebar

Related Questions

I have a class that subclasses UIView called DrawView. This class contains custom drawing
I'm developing an iOS 4.0 application. I want to add a custom UIView over
I want add my custom sidebar next right column all page. Please check this
Is there a way to add custom buttons to the WMD Editor that extends
I have a custom UIView that acts as a layout object. If I add
I have an NSMutableArray object that I want to add custom methods to. I
I have a custom UIView class that I want to spin, shrink and move
I want to add custom jump list entries to my application in Windows 7.
I want to add custom attribute settings to a generated anchor link of Wordpress.
How to add custom field into MarketPress (Wordpress)? I want to add 2 custom

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.