Getting Memory allocation problem at UIBarButtonItem in Iphone sdk.
Posted
by monish
on Stack Overflow
See other posts from Stack Overflow
or by monish
Published on 2010-03-27T11:45:23Z
Indexed on
2010/03/27
11:53 UTC
Read the original article
Hit count: 201
objective-c
Hi guys,
Here I am getting memory allocation problem at UIBarButtonItem and the related code for that is:
toolbar = [UIToolbar new];
toolbar.barStyle = UIBarStyleBlackOpaque;
[toolbar setFrame:CGRectMake(0, 350,320,20)];
[self.view addSubview:toolbar];
UIBarButtonItem* barItem1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:@selector(categoryConfig:)] ;
rightBarItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(dialogOtherAction:)] ;
UIBarButtonItem* barItem2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:@selector(categoryConfig:)] ;
NSArray *items = [NSArray arrayWithObjects: barItem1,rightBarItem,barItem2, nil];
[barItem1 release];
[barItem2 release];
[rightBarItem release];
[toolbar setItems:items animated:NO];
after adding UIBarButtonItems into the array items I released them.even though its showing allocations at barbuttons.
can any help me for this?
Thank you, Monish.
© Stack Overflow or respective owner