Tabbar_ios for IOS to implement custom transparent backgrounds

Source: Internet
Author: User
Tags transparent color

Don't talk much, just look at the sample code

'//Uiimageview *imageview = [[Uiimageview alloc]initwithframe:cgrectmake (0, 0, KSCREENW, Tabbarheight + 5)];
[ImageView setimage:[self Createimagewithcolor:[uicolor Clearcolor]];
[ImageView Setcontentmode:uiviewcontentmodescaletofill];

  [Self.tabbar Insertsubview:imageview atindex:0];
Upper horizontal line covering primary tabbar//[[Uitabbar appearance] setshadowimage:[self Createimagewithcolor:[uicolor Clearcolor]];
  Background picture is transparent color//[[Uitabbar appearance] setbackgroundimage:[self Createimagewithcolor:[uicolor Clearcolor]];
Self.tabBar.backgroundColor = [Uicolor Clearcolor];

Set to semitransparent self.tabBarController.tabBar.translucent = YES;
  "'-(uiimage*) Createimagewithcolor: (uicolor*) Color {cgrect Rect=cgrectmake (0.0f, 0.0f, 1.0f, 1.0f);
  Uigraphicsbeginimagecontext (rect.size);
  Cgcontextref context = Uigraphicsgetcurrentcontext ();
  Cgcontextsetfillcolorwithcolor (context, [color Cgcolor]);
  Cgcontextfillrect (context, rect); UIImage *theimage = UigraphicsgetimagefromcurrentimagecOntext ();
  Uigraphicsendimagecontext ();
return theimage; }


```

These are the full contents of the Tabbar in iOS to implement a custom transparent background, and hopefully this article will help.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.