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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:20:17+00:00 2026-05-27T12:20:17+00:00

I am looking to customize an AQGridViewCell by adding a title, date, and image

  • 0

I am looking to customize an AQGridViewCell by adding a title, date, and image for each cell.

What I have tried so far is:

//View Controller

- (AQGridViewCell *) gridView: (AQGridView *) gridView cellForItemAtIndex: (NSUInteger) index
{
    static NSString * CellIdentifier = @"CellIdentifier";

    IssueCell * cell = (IssueCell *)[self.gridView dequeueReusableCellWithIdentifier: CellIdentifier];
    if ( cell == nil )
    {
        cell = [[IssueCell alloc] initWithFrame: CGRectMake(0.0, 0.0, 72.0, 72.0) reuseIdentifier: CellIdentifier];
    }

    //This model object contains the title, picture, and date information
    IssueModel *m = (IssueModel *)[self.issues objectAtIndex:index];
    [cell setIssueModel:m];
    return cell;
}

//Cell class

#import "IssueCell.h"
#import <QuartzCore/QuartzCore.h>

@implementation IssueCell
@synthesize issueModel;

- (id) initWithFrame: (CGRect) frame reuseIdentifier:(NSString *) reuseIdentifier
{
    self = [super initWithFrame: frame reuseIdentifier: reuseIdentifier];
    if ( self == nil )
        return ( nil );


    self.contentView.backgroundColor = [UIColor redColor];
    self.backgroundColor = [UIColor blueColor];

    self.contentView.opaque = NO;
    self.opaque = NO;

    self.selectionStyle = AQGridViewCellSelectionStyleNone;

    return self;
}
@end

My questions is, since init is called before I have access to the model object, where can I setup the title, picture, and date for my cell?

  • 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-27T12:20:17+00:00Added an answer on May 27, 2026 at 12:20 pm

    You have to initialize your UI components in the initWithFrame. Example:

    In the interface of your IssueCell add UI variables you would like to have:

    @interface IssueCell : AQGridViewCell {
    
         UIImageView *im;
         UILabel *dateLabel;
    }
    
    - (id) initWithFrame: (CGRect) frame reuseIdentifier:(NSString *) reuseIdentifier
    {
        self = [super initWithFrame: frame reuseIdentifier: reuseIdentifier];
        if ( self == nil )
            return ( nil );
    
        self.contentView.backgroundColor = [UIColor redColor];
        self.backgroundColor = [UIColor blueColor];
    
        self.contentView.opaque = NO;
        self.opaque = NO;
    
        self.selectionStyle = AQGridViewCellSelectionStyleNone;
    
        im = [[UIImageView alloc] initWithFrame:yourImageViewFrameHere];
        dateLabel = [[UILabel alloc] initWithFrame:yourLabelFrameHere];
    
        [self addSubview:im];
        [self addSubview:dateLabel];
    
        return self;
    }
    @end
    

    Later, you assign desired values in the cellForItemAtIndex method. Example:

    - (AQGridViewCell *) gridView: (AQGridView *) gridView cellForItemAtIndex: (NSUInteger) index
    {
        static NSString * CellIdentifier = @"CellIdentifier";
    
        IssueCell * cell = (IssueCell *)[self.gridView dequeueReusableCellWithIdentifier: CellIdentifier];
        if ( cell == nil )
        {
            cell = [[IssueCell alloc] initWithFrame: CGRectMake(0.0, 0.0, 72.0, 72.0) reuseIdentifier: CellIdentifier];
        }
    
        //This model object contains the title, picture, and date information
        //
        IssueModel *m = (IssueModel *)[self.issues objectAtIndex:index];
        [cell.im setImage: m.picture];
        [cell.dateLabel setText:[date localizedDescription]];
        return cell;
    }
    

    Do not store your model data in the UI components. That’s a no no. Keep your model separated from the UI. This is only a pseudocode, not tested since I do not have my mac here.

    Let me know if it helps.

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

Sidebar

Related Questions

I have been looking around on how to customize Android TabWidget using XML with
I'm looking to customize the default date header in blogger with jQuery. The original
I have a generic sitemap working. I'm now looking to customize the output. Im
I'm looking to customize the tooltip look of an asp.net chart. Does anyone have
I'm looking for a good tutorial on how to customize a DataSource in SmartGWT
and thank you for looking into my question. I would like to customize the
I have been looking into MeeGo, maemo, Android architecture. They all have Linux Kernel,
I am not sure if I have set the right title for this post
I'm looking to customize the order for subcategories listed in a navigation bar in
im looking for a way to customize my Authorize Attribute so that i can

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.