Replace initWithNibName Method
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { self.title = @"Article view"; self.tabBarItem.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0); NSLog(@"count = %d",[self.tabBarController.tabBar.items count]); } return self; }
self.tabBarItem.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0); this line here adjusts the position of the image for tabBarItem as follows:
Move the image in the "+5" direction along the x axis and in the "-5" direction in the default direction.
Play with UIEdgeInsetsMake and have fun. Greetings.
source share