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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:04:40+00:00 2026-06-18T10:04:40+00:00

I am pretty new to Xcode and this simple problem has been driving me

  • 0

I am pretty new to Xcode and this simple problem has been driving me mad! I have created an expandable table that works fine. This is some of the code on a UIView subclass for the section that expands when you tap on a cell:

- (id)initWithFrame:(CGRect)frame WithTitle: (NSString *) title Section:(NSInteger)sectionNumber delegate: (id <SectionView>) Delegate
{
self = [super initWithFrame:frame];
if (self) {

    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(discButtonPressed:)];
    [self addGestureRecognizer:tapGesture];

    self.userInteractionEnabled = YES;

    self.section = sectionNumber;
    self.delegate = Delegate;

    CGRect LabelFrame = CGRectMake(100, 100, 100, 100);
    LabelFrame.size.width -= 100;
    CGRectInset(LabelFrame, 1.0, 1.0);

    //BUTTON 
    CGRect buttonFrame = CGRectMake(LabelFrame.size.width, 0, 100, LabelFrame.size.height);
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = buttonFrame;
    //[button setImage:[UIImage imageNamed:@"carat.png"] forState:UIControlStateNormal];
    //[button setImage:[UIImage imageNamed:@"carat-open.png"] forState:UIControlStateSelected];
    [button addTarget:self action:@selector(discButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:button];
    self.discButton = button;

    //My IMAGE
    NSString *imageName = @"gradient1.png";
    UIImage *myImage = [UIImage imageNamed:imageName];
    UIImageView *sectionHeaderView = [[UIImageView alloc] initWithImage:myImage];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage];
    imageView.frame = CGRectMake(20,50,100,100);
    [self addSubview:sectionHeaderView];
    self.headerBG = sectionHeaderView;

    //HEADER LABEL
    UILabel *label = [[UILabel alloc] initWithFrame: CGRectMake(22, 12, sectionHeaderView.frame.size.width, 35.0)];
    label.textAlignment = NSTextAlignmentLeft;
    label.backgroundColor = [UIColor clearColor];
    label.textColor = [UIColor whiteColor];
    label.shadowColor = [UIColor darkGrayColor];
    label.shadowOffset = CGSizeMake(0.0, -1.0);
    label.text = title;
    label.font = [UIFont fontWithName:@"AvenirNext-Bold" size:20.0];
    sectionHeaderView.backgroundColor = [UIColor clearColor];
    //label.textAlignment = UITextAlignmentLeft;
    [self addSubview:label];
    self.sectionTitle = label;
}

return self;
}

I have a custom image on the cell @”gradient1.png” but I don’t seem to be able to resize it? Here is the header code in the UITableViewController:

    - (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:   (NSInteger)section
  {
SectionInfo *array  = [self.sectionInfoArray objectAtIndex:section];
if (!array.sectionView)
{
    NSString *title = array.category.name;
    array.sectionView = [[SectionView alloc] initWithFrame:CGRectMake(0, 10, self.tableView.bounds.size.width, 0) WithTitle:title Section:section delegate:self];
}
return array.sectionView;
}

Sorry if this is a trivial question, your help is greatly appreciated!

  • 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-18T10:04:42+00:00Added an answer on June 18, 2026 at 10:04 am

    I don’t see where you are trying to resize the image so I can’t offer any help in why it is not resizing, but I found this confusing:

    //My IMAGE
        NSString *imageName = @"gradient1.png";
        UIImage *myImage = [UIImage imageNamed:imageName];
        UIImageView *sectionHeaderView = [[UIImageView alloc] initWithImage:myImage];
        UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage];
        imageView.frame = CGRectMake(20,50,100,100);
        [self addSubview:sectionHeaderView];
        self.headerBG = sectionHeaderView;
    

    In this part of code you create two imageviews, then you resize one and add the other to the cell (I’m assuming cell) subviews. Is it possible that you are trying to resize the view that you never added as a subview of the cell?

    Also, resizing should happen inside - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath.

    Make sure that you are resizing the proper view, ten make sure you are resizing it in the proper place.

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

Sidebar

Related Questions

Pretty new to threading and I have this QList that the threads share between
So I am pretty new to Xcode and Objective C, I've been using it
Pretty new to MVC and the like. I have a class the looks like
I am pretty new to PHP and MySQL and I just can't figure this
I'm still pretty new to ObjC. I noticed that it's pretty standard everywhere to
I'm pretty new to PHP, but I decided to try and make a simple
I am pretty new to buddypress. I am trying to do something pretty simple
I've been following this Apple Doc to add a custom UITableViewCell that I layed
Pretty new to all this, so if I am going about my puzzle in
Still pretty new to ObjectiveC and Cocoa here. Hopefully the answer to this question

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.