In my application, I use the following code below: -
NSArray* toolbarItems = [NSArray arrayWithObjects:
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done)], nil];
[toolbarItems makeObjectsPerformSelector:@selector(release)];
To do this, it shows the potential leak of the object.
source
share