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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:35:54+00:00 2026-05-23T22:35:54+00:00

I subclassing TTTableMessageItemCell, got EXC_BAD_ACCESS runtime error. Anythign wrong? CustomTTTableSubtitleItemCell.h #import Three20/Three20.h @interface CustomTTTableSubtitleItemCell

  • 0

I subclassing TTTableMessageItemCell, got EXC_BAD_ACCESS runtime error. Anythign wrong?

CustomTTTableSubtitleItemCell.h

#import "Three20/Three20.h"
@interface CustomTTTableSubtitleItemCell : TTTableMessageItemCell {
    TTButton *_rightButton;
}

@end

CustomTTTableSubtitleItemCell.m

#import "CustomTTTableSubtitleItemCell.h"
#import "CustomTTTableSubtitleItem.h"
#import "XYDefaultStyleSheet.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

static CGFloat kHPadding = 10;
static CGFloat kVPadding = 15;


@interface ButtonStyleSheet : TTDefaultStyleSheet
@end

@implementation ButtonStyleSheet

- (TTStyle*)blueToolbarButton:(UIControlState)state {
    TTShape* shape = [TTRoundedRectangleShape shapeWithRadius:4.5];
    UIColor* tintColor = RGBCOLOR(30, 110, 255);
    return [TTSTYLESHEET toolbarButtonForState:state shape:shape tintColor:tintColor font:nil];
}

@end


@implementation CustomTTTableSubtitleItemCell


+ (CGFloat)tableView:(UITableView*)tableView rowHeightForItem:(id)item {
    CustomTTTableSubtitleItem* captionedItem = item;

    CGFloat maxWidth = tableView.width - kHPadding*2;

    CGSize titleSize = [captionedItem.title sizeWithFont:TTSTYLEVAR(myTitleFont)
                                     constrainedToSize:CGSizeMake(maxWidth, CGFLOAT_MAX)
                                         lineBreakMode:UILineBreakModeWordWrap];

    CGSize textSize = [captionedItem.text sizeWithFont:TTSTYLEVAR(myHeadingFont)
                                     constrainedToSize:CGSizeMake(maxWidth, CGFLOAT_MAX)
                                         lineBreakMode:UILineBreakModeWordWrap];
    CGSize subtextSize = [captionedItem.caption sizeWithFont:TTSTYLEVAR(mySubtextFont)
                                           constrainedToSize:CGSizeMake(maxWidth, CGFLOAT_MAX) lineBreakMode:UILineBreakModeWordWrap];

    return kVPadding*2 + titleSize.height + textSize.height + subtextSize.height + kVPadding;
}




- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)identifier {
    if (self = [super initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:identifier]) {
        _item = nil;
        [TTStyleSheet setGlobalStyleSheet:[[[ButtonStyleSheet alloc] init] autorelease]];


    }
    return self;
}


- (void)layoutSubviews {
    [super layoutSubviews];

    [self.detailTextLabel sizeToFit];
    self.detailTextLabel.top = kVPadding;

    self.textLabel.height = self.detailTextLabel.height;

    //_rightButton.frame = CGRectMake(20, self.detailTextLabel.bottom + kVPadding, kImageWidth, kImageHeight);

        //_rightButton.alpha = !self.showingDeleteConfirmation;
        [_rightButton sizeToFit];
        _rightButton.left = self.contentView.width - (_timestampLabel.width + kHPadding);
        _rightButton.top = self.height/2;



}

- (id)object {
    return _item;
}

- (void)setObject:(id)object {
    if (_item != object) {
        [super setObject:object];

        CustomTTTableSubtitleItem* item = object;


        //self.textLabel.textColor = TTSTYLEVAR(myHeadingColor);
//      self.textLabel.font = TTSTYLEVAR(myHeadingFont);
//      self.textLabel.textAlignment = UITextAlignmentRight;
//      self.textLabel.contentMode = UIViewContentModeCenter;
//      self.textLabel.lineBreakMode = UILineBreakModeWordWrap;
//      self.textLabel.numberOfLines = 0;
//      
//      self.detailTextLabel.textColor = TTSTYLEVAR(mySubtextColor);
//      self.detailTextLabel.font = TTSTYLEVAR(mySubtextFont);
//      self.detailTextLabel.textAlignment = UITextAlignmentLeft;
//      self.detailTextLabel.contentMode = UIViewContentModeTop;
//      self.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;


        _rightButton = [TTButton 
                        buttonWithStyle:@"blueToolbarButton:" title:item.rightButtonTitle]; 




    }
}

- (void)dealloc {
    TT_RELEASE_SAFELY(_rightButton);
    [super dealloc];
}

@end
  • 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-23T22:35:54+00:00Added an answer on May 23, 2026 at 10:35 pm

    You’re creating the TTButton using autorelease, while you’re releasing it in your dealloc function. So both the release pool and the dealloc are trying to release your _rightButton TTButton.

    in your header file, try adding:

    @property (nonatomic, readonly, retain) TTButton*      rightButton;
    

    And then create the TTButton using his get function in your source file:

    ///////////////////////////////////////////////////////////////////////////////////////////////////
    - (TTButton*)rightButton {
     if (!_rightButton) {
        _rightButton = [[TTButton 
                         buttonWithStyle:@"blueToolbarButton:" title:item.rightButtonTitle] retain]; 
    
        [self.contentView addSubview:rightButton];
      }
     return rightButton;
    }
    

    When using the rightButton, make sure to use self.rightBotton and not _rightButton, such as in the layout function (Because you need to object to be created).

    self.rightButton.frame = CGRectMake(20, self.detailTextLabel.bottom + kVPadding, kImageWidth, kImageHeight);
    

    I suggest opening the Three20UI/TTTableMessageItemCell.h & source file and trying to copy the behavior of one of the elements. That’s what I did.

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

Sidebar

Related Questions

I'm subclassing NSTextField MultiTextField.h #import <AppKit/AppKit.h> @interface MultiTextField : NSTextField { id storedObject; }
I am subclassing NSObject @interface MyClass : NSObject { } -(id)customInit; @end and implementing
Question about subclassing in matlab, under the new class system. I've got class A
I'm subclassing the CrudRestController to implement an REST interface. It works fine, but the
Following an advice in the answer: subclassing beautifulsoup html parser, getting type error ,
I'm subclassing a native window (the edit control of a combobox...) oldWndProc = SetWindowLong(HandleOfCbEditControl,
I'm subclassing the standard ListBox control. I get notified of changes to any of
I'm not subclassing the control. Trying to trigger the event via Control.Size = Control.Size
I'm subclassing QProgressBar in a custom widget, and I overwrote the paintEvent method with
I'm subclassing NSUserDefaults in my application. A side effect of this is I can't

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.