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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:44:18+00:00 2026-05-23T15:44:18+00:00

I was trying to recreate a Xcode project but I came across an error

  • 0

I was trying to recreate a Xcode project but I came across an error “‘initWithFrame:reuseIdentifier’ is deprecated”.
Here is the code:

- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) {
    UIView *myContentView = self.contentView;

    self.todoPriorityImageView = [[UIImageView alloc] initWithImage:priority1Image];
    [myContentView addSubview:self.todoPriorityImageView];
    [self.todoPriorityImageView release];

    self.todoTextLabel = [self newLabelWithPrimaryColor:[UIColor blackColor] 
                                          selectedColor:[UIColor whiteColor] fontSize:14.0 bold:YES]; 
    self.todoTextLabel.textAlignment = UITextAlignmentLeft; // default
    [myContentView addSubview:self.todoTextLabel];
    [self.todoTextLabel release];

    self.todoPriorityLabel = [self newLabelWithPrimaryColor:[UIColor blackColor] 
                                              selectedColor:[UIColor whiteColor] fontSize:10.0 bold:YES];
    self.todoPriorityLabel.textAlignment = UITextAlignmentRight;
    [myContentView addSubview:self.todoPriorityLabel];
    [self.todoPriorityLabel release];

    // Position the todoPriorityImageView above all of the other views so
    // it's not obscured. It's a transparent image, so any views
    // that overlap it will still be visible.
    [myContentView bringSubviewToFront:self.todoPriorityImageView];
}return self;}

I am getting the error on line2 with the start of the if-statement.
This function is clearly not adviceable to use anymore and it now is this function:

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
    // Initialization code.
}
return self;}

I don’t really know how I can modify the above function and put it in the newer function! Could some1 help me on this matter please?

Thx

Kevin

  • 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-23T15:44:18+00:00Added an answer on May 23, 2026 at 3:44 pm

    The new initializer is using a UITableViewCellStryle instead of specifying the frame CGRect for the cell and you were just giving the frame to the superclass in [super initWithFrame:frame reuseIdentifier:reuseIdentifier]. So, there should be not problem to put all the same code in the new version, without the if statement.

    You had :

    - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
        if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) {
            // all your stuff
        }
        return self;
    }
    

    You now have :

    - (id)initWithStyle:(UITableViewCellStyle)style
        reuseIdentifier:(NSString *)reuseIdentifier {
        if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
            // all your stuff
        }
        return self;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to recreate a modernized version of this tutorial here - but I'm
I am trying to recreate the FragmentPagerSupport example but I keep getting an error
this may sound funny, but i spent hours trying to recreate a knob with
I am trying to recreate SwiXML examples in JRuby. But the objects created in
I'm trying to recreate a sort of table layout of a contact form. Here's
I'm trying to recreate this UISearchBar (as seen in the Table Search example code):
I'm trying to recreate the 'Overlay and Shadow Classes' effect used here: http://jqueryui.com/themeroller/ with
Im trying to recreate this page http://psdtowp.com/order-now but for another purpose, Im very new
i'm trying to recreate the MVC model of their simple example but i'm having
I am trying to recreate an existing project with Maven (any IDE is ok,

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.