Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何在iOS 5中删除Uitabritem的渐变/阴影_Iphone_Ios_Xcode_Uitabbarcontroller - Fatal编程技术网

Iphone 如何在iOS 5中删除Uitabritem的渐变/阴影

Iphone 如何在iOS 5中删除Uitabritem的渐变/阴影,iphone,ios,xcode,uitabbarcontroller,Iphone,Ios,Xcode,Uitabbarcontroller,有了iOS5,就有了UI的外观,有没有可能用简单的方式去除渐变呢 我这样做是为了定制我的标签栏,可以做什么来消除梯度 谢谢你的阅读 -(void)UIAppearances { //set the background of tab bar UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"navbar_bgrd.png"]]; if ([[[UIDevic

有了iOS5,就有了UI的外观,有没有可能用简单的方式去除渐变呢

我这样做是为了定制我的标签栏,可以做什么来消除梯度

谢谢你的阅读

-(void)UIAppearances
{
    //set the background of tab bar
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"navbar_bgrd.png"]];

    if ([[[UIDevice currentDevice] systemVersion] floatValue] > 4.9) {
        //iOS 5
        //[self.tabBarController.tabBar insertSubview:imageView atIndex:1];

        [[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"navbar_bgrd.png"]];
        [[UITabBar appearance] setSelectionIndicatorImage:
         [UIImage imageNamed:@"navbaractive.png"]];


        [[UITabBarItem appearance] setTitleTextAttributes:
         [NSDictionary dictionaryWithObjectsAndKeys:
          [UIColor colorWithRed:75.0/255.0 green:75.0/255.0 blue:75.0/255.0 alpha:1.0], UITextAttributeTextColor, 
          [UIColor clearColor], UITextAttributeTextShadowColor, 
          [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset, 
          nil] forState:UIControlStateNormal];

        [[UITabBarItem appearance] setTitleTextAttributes:
         [NSDictionary dictionaryWithObjectsAndKeys:
          [UIColor whiteColor], UITextAttributeTextColor, 
          [UIColor clearColor], UITextAttributeTextShadowColor, 
          [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset, 
          nil] forState:UIControlStateSelected];   


        //nav bar
        [[UINavigationBar appearance] setTitleTextAttributes: 
         [NSDictionary dictionaryWithObjectsAndKeys:  
          [UIFont fontWithName:@"Rokkitt" size:28.0],
          UITextAttributeFont,
          nil]];
    }
    else {
        //iOS 4.whatever and below
        [self.tabBarController.tabBar insertSubview:imageView atIndex:0];

    }   

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:NO];

}

UITabBar可以拍摄一幅图像并使用其alpha通道(不透明度)构建选定/未选定的图像,或者拍摄两幅处理后的图像以原样使用


您必须亲自向UITabBarItem提供图像。除了使用UITabBar的外观属性更改渐变颜色外,没有其他方法可以影响它对图像的处理。

u只能使用ios 5和ios 5newer@lesyk:正确。我链接到了文档,文档中也提到了这一点,这就是为什么我没有提到它。在iOS之前我不知道如何做到这一点,因为我还没有研究过它;也许你是UITabBar的子类,也许你建立了自己的。