I have create a UIViewController with multiple subviews.. To switch to all subviews i have added a segmented control.. screen looks like this..

On the second view i have added a UIToolbar, using this line of code..
toolbar = [UIToolbar new];
toolbar.barStyle = UIBarStyleDefault;
[toolbar sizeToFit];
toolbar.frame = CGRectMake(0, 0, 800, 40);
UIBarButtonItem *filterByClass = [[UIBarButtonItem alloc] initWithTitle:@"A" style:UIBarButtonItemStyleBordered target:self action:@selector(goToFilteredByClass:)];
UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
NSArray *buttonItems = [NSArray arrayWithObjects:filterByClass, spacer, nil];
[toolbar setItems:buttonItems animated:NO];
So the screen will look like this..

when i go back to segment A, here’s my screen..

then data is covered by the toolbar.. I want to remove it because segment A doesn’t have a toolbar.. Is there a way to fix this issue..?
Thanks,
Link
Set up an action in your view controller, and have your segmented control call that action when its “value changed” event fires.
The segments of the control are numbered like an array, from 0 onwards. In your action method, you test for the segment you’re interested in (in this case, segment 0) and show or hide the toolbar. You could animate it offscreen too, if you prefer a sliding animation.
If you aren’t worried about leaving the toolbar for reuse later, you could use removeFromSuperview in your action method; but you won’t get the animation if you use this method.
Quick example for hiding it using Core Animation: