iOS 5: UITabBarItem setFinishedSelectedImage:withFinishedUnselectedImage: not working / ignored

前端 未结 2 1277
悲&欢浪女
悲&欢浪女 2021-01-07 08:48

As per Apple docs

I\'m trying to set custom finished selected and unselected images on a UITabBarItem like so:


...
DetailViewController *vc1 = [[Det         


        
2条回答
  •  时光取名叫无心
    2021-01-07 09:14

    If your are trying to achieve displaying of the actual image at the UITabBar then use the following code.

    [yourTabBarItem setImage:[[UIImage imageNamed:@"more.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    

    and if you want to display image in original condition for the selected then use the following

    [yourTabBarItem setSelectedImage:[[UIImage imageNamed:@"more.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    

    these two are alternative to

    setFinishedSelectedImage:  withFinishedUnselectedImage:
    

提交回复
热议问题