getting memory allocation at ActivityIndicator in Iphone sdk

Posted by monish on Stack Overflow See other posts from Stack Overflow or by monish
Published on 2010-03-25T07:20:00Z Indexed on 2010/03/25 7:23 UTC
Read the original article Hit count: 388

Filed under:

Hi Guys,

     Here Im gettimg memory allocation problem at activity indicator and My code is:

- (id)init {
if (self = [super init]) {
    self.title=@"Release Details";
    contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
    contentView.backgroundColor = [UIColor clearColor];

    self.view = contentView;

    [contentView release];

    CGRect frame = CGRectMake(0,0, 320,1500);

    containerView = [[UIView alloc] initWithFrame:frame];
    webView = [ [UIWebView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    webView.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"background1.png"]];
    webView.delegate = self;        
    [containerView addSubview:webView];


    CGRect activityViewframe = CGRectMake(20,8,20, 20);

    progressInd = [[UIActivityIndicatorView alloc] initWithFrame:activityViewframe];

    progressInd.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
    progressInd.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
                                    UIViewAutoresizingFlexibleRightMargin |
                                    UIViewAutoresizingFlexibleTopMargin |
                                    UIViewAutoresizingFlexibleBottomMargin);
    [containerView addSubview:progressInd];
    [progressInd startAnimating];
    progressInd.hidden = NO;
    [progressInd stopAnimating];
    [self.view addSubview:containerView];
    isFetch=YES;

}
return self;
}


-(void) displayInProgressRightBarButton
{

UIView* rightBarButtonView = [ [UIView alloc] initWithFrame:CGRectMake(270,5,45, 35)];
[rightBarButtonView addSubview:progressInd];
UIBarButtonItem* buttonItem = [[UIBarButtonItem alloc] 
                               initWithCustomView:rightBarButtonView];

self.navigationItem.rightBarButtonItem = buttonItem;
[rightBarButtonView release];
[buttonItem release];
}
- (void)webViewDidStartLoad:(UIWebView *)webView
{
[self displayInProgressRightBarButton];
[progressInd startAnimating];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
[progressInd stopAnimating];

[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}

Also I released the progressInd in dealloc eventhough it showing memory allocation at

progressInd = [[UIActivityIndicatorView alloc] initWithFrame:activityViewframe];

in init.

can anyone help me to solve this.

Anyone's help will be much Appreciated.

Thank you, Monish.

© Stack Overflow or respective owner

Related posts about objective-c