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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:18:20+00:00 2026-05-25T22:18:20+00:00

I have a class defined where the top two properties are accessible without issue.

  • 0

I have a class defined where the top two properties are accessible without issue. Only the UIColor* is a problem. I imagine something isn’t being alloc’d, init’d, retained, or released properly and have been changing various things without success. Any help would be grand.

// PieceScore.h

@interface PieceScore : NSObject {
    int     pieceCount;
    BOOL    greatMatch;
    UIColor *colorMatched;
}

@property (nonatomic) int pieceCount;
@property (nonatomic) BOOL greatMatch;
@property (nonatomic, retain) UIColor *colorMatched;

-(id) initWithPieceCount:(int)pC withGreatMatch:(BOOL)gM withColorMatched:(UIColor*)cM;

@end


// PieceScore.m

@implementation PieceScore

@synthesize pieceCount, greatMatch, colorMatched;

-(id) init {
    return [self initWithPieceCount:0 withGreatMatch:NO withColorMatched:[UIColor clearColor]];
}

-(id) initWithPieceCount:(int)pC withGreatMatch:(BOOL)gM withColorMatched:(UIColor*)cM {
    self = [super init];
    if (self) {
        pieceCount = pC;
        greatMatch = gM;
        colorMatched = cM;
    }
    return self;
}

@end

It is initialized and returned by another class as follows:

PieceScore* pieceScore = [[[PieceScore alloc] initWithPieceCount:piecesRemoved withGreatMatch:greatMatch withColorMatched:pieceColor] autorelease];
return pieceScore;

NOTE: (pieceColor is a UIColor*)

Then, the UIColor* is used in a method of yet another class:

- (void) labelRender:(UILabel*)label withColor:(UIColor *)color {
    // ...

    label.textColor = color; // Thread 1: Program received signal: "EXC_BAD_ACCESS".

    // ...
}

In the debug view, I can see that color is actually being passed as a UIColor*, but is error-ing out when being assigned to the label’s textColor property.

  • 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-25T22:18:21+00:00Added an answer on May 25, 2026 at 10:18 pm

    You are setting the ivar to an autoreleased variable. Make sure you use the property so that it is properly retained.

    Change colorMatched = cM; to self.colorMatched = cM;

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

Sidebar

Related Questions

I have a class with two methods defined in it. public class Routines {
I have a DIV container that is a CSS class defined on the top
I have the following defined at the top of my XAML: <controls:ChildWindow x:Class=MyProject.SilverlightUI.Views.CharacterGenerator xmlns:my=clr-namespace:MyProject.SilverlightUI.ViewModels
I have a class defined as public class viewGroups extends ListActivity Somewhere in the
I have a class defined as: class Obj { public: int width, height; Obj(int
I have a templated class defined (in part) as template <class T> MyClass {
I have the ViewValue class defined as follows: class ViewValue { private Long id;
We have a class Car defined like this in a car.rb file class Car
I have a template class defined like so: template <class T> class Command {
I have a class that defined a user defined operator for a TCHAR*, like

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.