I have an application in tabbar, but I need to put a UIButton insted of a tabbar button. There are 4 tabbarbuttons in it, I want to replace the one with UIButton. Thanks.
If you want to use UIButtton instead of tabbar, use all four tabs. Make one tab blank and put a button of same size at same view on which you want to replace.
Assuming you mean toolBar instead of tabBar (otherwise this question makes no sense; see below), just save the items in an NSMutableArray and replace the object at index i with whatever you wish to replace it with, then set the new array as the toolBar items once again.
You can figure out all the details of doing this by reading the UIToolbar Documentation. In short, I'm suggesting something along the lines of this:
NSMutableArray *tmpArray = [NSMutableArray arrayWithArray:toolBar.items];
[tmpArray replaceObjectAtIndex:1 withObject:myButton];
[toolBar setItems:tmpArray animated:YES];
Why does it make no sense to put a button in a tabbar?
Well, a few reasons. You can't is probably the best. Another good one is that any action you want for the would-be button can be put instead into the viewWillAppear
method of the viewController that appears when that tabbar selection is made.