自定义tabbar

当tabBar不能满足需求时(如需要在其中间添加一个不规则的加号按钮)

通过KVC更换系统的tabBar

[self setValue:[[YQTabBar alloc] init] forKeyPath:@"tabBar"];

并更改内部按钮的frame

- layoutSubviews

遍历子视图,当其不是UIControl(这里是UITabBarButton)或者是添加的按钮时,就跳过

if (![button isKindOfClass:[UIControl class]] || button == self.publishButton) continue;

原文地址:https://www.cnblogs.com/sea-star3/p/5301041.html