viewController.tabBarItem.image with gif image in UITabbarController does not Render with Original in IOS 13 beta , Other version system are work well.

this is my code:

NSMutableArray *imagesArray = [NSMutableArray array];

for (NSInteger i = 0; i < 3; i++) {

UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"Speed_Dian_%ld",i]];

[imagesArray addObject:image];

}

UIImage *animationImage = [UIImage animatedImageWithImages:imagesArray duration:1.0];

vc.tabBarItem.image = [animationImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

vc.tabBarItem.selectedImage = [animationImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];


it is rendered in grey outline IN IOS13 , Other version system is work well. how can i repair it?

Replies

Does your image asset have an "~iphone" in its file name?


I should be more specific for the record... It appears to me that in iOS 13 loading assets with an "~image" in their file name from a bundle (not .xcassets) fail. This is not the case in iOS 13.1 or iOS 12.x.

this did worked well.


- (void)viewDidLoad

{

[super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

NSMutableArray *viewControllers = [NSMutableArray array];

for (NSInteger i=0; i<4; i++) {

HICViewController *vc = [[HICViewController alloc] init];

[viewControllers addObject:vc];

}

self.viewControllers = viewControllers;

NSMutableArray *imagesArray = [NSMutableArray array];

for (NSInteger i = 0; i < 3; i++) {

UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"Coin_Speed_Dian_%ld",i]];

if (@available(iOS 13.0, *)) {

image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];//IOS13 Need

}

[imagesArray addObject:image];

}

UIImage *animationImage = [UIImage animatedImageWithImages:imagesArray duration:1.0];

for (HICViewController *vc in self.viewControllers) {

vc.tabBarItem.image = [animationImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

vc.tabBarItem.selectedImage = [animationImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

}

}