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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:31:59+00:00 2026-05-25T15:31:59+00:00

This is my code – (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index { MWFeedItem *item = [reader.feedItems

  • 0

This is my code

- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
{
    MWFeedItem *item = [reader.feedItems objectAtIndex:index];

    //INIZIALIZZO L'ARRAY CARICANDOLO DAL FILE!!!!
    //[reader.feedItems initWithContentsOfFile:[[NSDictionary alloc] initWithContentsOfFile:@"Library/NewsPad"]];

    //create a numbered view
    UIView *view = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"page_iPhone_Vertical.png"]] autorelease];

    CGRect frame = CGRectMake(40, 118, 228, 100);

    UILabel *labelTitle = [[UILabel alloc] initWithFrame:frame];
    labelTitle.backgroundColor = [UIColor clearColor];
    labelTitle.textAlignment = UITextAlignmentLeft;
    labelTitle.font = [UIFont fontWithName:@"Helvetica-Bold" size:12];
    labelTitle.numberOfLines=3;
    [view addSubview:labelTitle];

    labelTitle.text = item.title;

    [view addSubview:labelTitle];

    /* DATA
     RSSEntry *entry = [_allEntries objectAtIndex:index];

     NSDateFormatter * dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
     [dateFormatter setTimeStyle:NSDateFormatterMediumStyle];
     [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
     NSString *articleDateString = [dateFormatter stringFromDate:entry.articleDate];
     */

    NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
    NSInteger loadImage=[settings objectForKey:@"loadImage"];

    /******** Get the image **********/
    NSString *url = [self getFirstImage:item.summary];
    //NSString *url = item.image;

    if (loadImage != 0 && url != nil) {
        //Create a managed image view and add it to the cell (layout is very naieve)

        image = [[EGOImageView alloc] initWithPlaceholderImage:[UIImage imageNamed:@"loading.png"]];
        image.frame = CGRectMake(45, 200, 210, 150);
        [view addSubview:image];
        image.imageURL = [NSURL URLWithString:url];

        /* OLD!!!
         HJManagedImageV *image;
         image = [[[HJManagedImageV alloc] initWithFrame:CGRectMake(45, 200, 210, 150)] autorelease];
         image.tag = 999;

         [view addSubview:image];

         //set the URL that we want the managed image view to load
         image.url = [NSURL URLWithString:url];

         //tell the object manager to manage the managed image view, 
         //this causes the cached image to display, or the image to be loaded, cached, and displayed
         [objMan manage:image];
         */

        frame= CGRectMake(40, 205, 230, 400);
        UILabel *desc = [[[UILabel alloc] initWithFrame:frame] autorelease];
        desc.numberOfLines=6;
        desc.backgroundColor = [UIColor clearColor];
        //desc.textAlignment = UITextAlignmentCenter;
        desc.font = [desc.font fontWithSize:12];
        [view addSubview:desc]; 
        //SETTO DESCRIPTION

        //rimuovo tag html
        NSString *descrizione=[item.summary stringByConvertingHTMLToPlainText];
        /* DEBUG
         NSString *descrizione=item.summary;

         */
        [desc setText:descrizione];

        //NSLog(item.summary);    
    }
    else {
        frame= CGRectMake(40, 90, 235, 400);
        UILabel *desc = [[[UILabel alloc] initWithFrame:frame] autorelease];
        desc.numberOfLines=15;
        desc.backgroundColor = [UIColor clearColor];
        //desc.textAlignment = UITextAlignmentCenter;
        desc.font = [desc.font fontWithSize:12];
        [view addSubview:desc]; 
        //SETTO DESCRIPTION
        //rimuovo tag html
        NSString *descrizione=[item.summary stringByConvertingHTMLToPlainText];
        /* DEBUG
         NSString *descrizione=item.summary;
         */
        [desc setText:descrizione];  
    }

    return view;
}

Why If I add to my code [labelTitle release] or [desc release] the app crashs?

  • 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-25T15:31:59+00:00Added an answer on May 25, 2026 at 3:31 pm

    You have a lot of code in that question.

    labelTitle looks fine from the code I see, but desc is an autoreleased object.

    UILabel *desc = [[[UILabel alloc] initWithFrame:frame] autorelease];
    

    It has a retain count of +1, but it has been autoreleased which will decrement that retain count at some future point in time (typically shortly after the variable goes out of scope). So, there is no reason to release it.

    You can read more about NSAutoReleasePool on apple’s docs.

    You can also look at How does the NSAutoreleasePool autorelease pool work?

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

Sidebar

Related Questions

This code works; int at(int index) { if(index < 1 || index >= size)
This code in JS gives me a popup saying i think null is a
This code is from Prototype.js . I've looked at probably 20 different tutorials, and
this code always returns 0 in PHP 5.2.5 for microseconds: <?php $dt = new
This code works (C# 3) double d; if(d == (double)(int)d) ...; Is there a
This code always works, even in different browsers: function fooCheck() { alert(internalFoo()); // We
This code does not seem to compile, I just need to write something to
This code produces a FileNotFoundException, but ultimately runs without issue: void ReadXml() { XmlSerializer
This code is executed by many way. When it's executed by the form button
This code leads to undefined behavior: void some_func() { goto undefined; { T x

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.