iOS设置tabbar不显示文字,只显示图片

1,504 阅读1分钟

首先我们设置tabbarItem的文字为空字符串@""

navigationViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"" image:normalImage selectedImage:selectImage];

然后设置图片的偏移

navigationViewController.tabBarItem.imageInsets = UIEdgeInsetsMake(5, 0, - 5, 0);

效果图

效果图