2017-04-06 3 views
0

私はtabBarItemの1つがGIFを表示する必要があるUITabBarControllerを持っています。私は3rd party libraryを使ってGIFを表示しようとしました。しかし、表示されたGIFは歪んでいます。それは1xサイズしか受け付けないからです。単一のtabBarControllerにGIFを追加する方法はありますか?私はカスタムTabBarControllerを使用したくありません。ここ はtabBarItemtabBarItemにGIFを追加

UITabBarItem *tabBarItemAtIndex2 = [self.tabBarController.tabBar.items objectAtIndex:2]; 
    [tabBarItemAtIndex2 setImage:[[UIImage imageNamed:@"InstantTabBar.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]]; 

    UITabBarItem *tabBarItem1 = [self.tabBarController.tabBar.items objectAtIndex:1]; 
// UIImage *img = [UIImage imageNamed:NSLocalizedString(@"IJPTabBar", nil)]; 

    NSURL *url = [[NSBundle mainBundle] URLForResource:@"instant" withExtension:@"gif"]; 

    UIImage *img = [UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url]]; 
    [tabBarItem1 setImage:img]; 

に私はTabBarItemにGIFを追加することができたおかげで

答えて

0

をGIFを設定するための私のコードです。私は2倍のGIFを使用し、TabBarItemのedgeInsetsを管理しました。さて、GIFはぼやけていません。

関連する問題