Getting Memory allocation problem at UIBarButtonItem in Iphone sdk.
- by monish
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.