I want to set padding (or resizing) for image used for tabBarItem. So in the controller I write the below code:
- (instancetype)init
{
self = [super init];
if (self) {
UIImage *i = [UIImage imageNamed:@"groups_icon"];
self.tabBarItem.image = i;
self.tabBarItem.imageInsets = UIEdgeInsetsMake(3, 3, 3, 3);
}
return self;
}
But after each time I press the tabBarItem the image is going to be smaller. How can I set it to do it only one time? I test it in the viewDidLoad and viewWillApear and the result is the same.
Also it is noticeable that I could not set the image for tabBarItem before using the relevant controller, when I initialized the UITabBarController.