代理的实现
#import <UIKit/UIKit.h>
@class ZBTabBar;
@protocol ZBTabBarDelegate <NSObject>
-(void)tabBar:(ZBTabBar *)tabBar didSelectButtonFrom:(int)from to:(int)to;
@end
@interface ZBTabBar : UIView
-(void)AddTabBarItemWithTabBarItem:(UITabBarItem *)item;
@property(nonatomic,weak)id<ZBTabBarDelegate> delegate;
@end
if ( [self.delegate respondsToSelector:@selector(tabBar:didSelectButtonFrom:to:)]) {
[self.delegate tabBar:self didSelectButtonFrom:self.tempButton.tag to:btn.tag];
}