Navigationbar becomes pure transparent
The first of these methods
Navigation bar Pure Transparent
[Self.navigationbar setbackgroundimage:[uiimage new] forbarmetrics:uibarmetricsdefault];
Remove the black line at the bottom of the navigation bar
Self.navigationBar.shadowImage = [UIImage new];
The second method of
[[Self.navigationbar subviews] Objectatindex:0].alpha = 0;
Tabbar
[Self.tabbar setbackgroundimage:[uiimage New];
Self.tabBar.shadowImage = [UIImage new];
Navigationbar According to the sliding distance gradient color realization
First Kind
-(void) Scrollviewdidscroll: (Uiscrollview *) ScrollView
{
CGFloat offsettoshow = 200.0;//Slide How much is fully displayed
CGFloat alpha = 1-(OFFSETTOSHOW-SCROLLVIEW.CONTENTOFFSET.Y)/offsettoshow;
[[Self.navigationController.navigationBar subviews] Objectatindex:0].alpha = alpha;
}
The second Kind
-(void) Scrollviewdidscroll: (Uiscrollview *) ScrollView
{
CGFloat offsettoshow = 200.0;
CGFloat alpha = 1-(OFFSETTOSHOW-SCROLLVIEW.CONTENTOFFSET.Y)/offsettoshow;
[Self.navigationController.navigationBar setshadowimage:[uiimage New];
[Self.navigationController.navigationBar setbackgroundimage:[self Imagewithcolor:[[uicolor Orangecolor] Colorwithalphacomponent:alpha]] forbarmetrics:uibarmetricsdefault];
}
Create a picture of a solid color
-(UIImage *) Imagewithcolor: (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;
}
IOS Navigationbar and Tabbar Transparent & Navigationbar based on sliding distance gradient