iphone - UINavigationBar gradient details -


I am trying to recreate the format of a UINavigationBar. The background of the bar is prepared using a gradient, but it is not clear what is the default color and point in it. Has anyone done anything in this area?

Adjust the colors of your choice from a project also show a background image if you want (ImageReady), and Apple's

  // #Lighter R, G, B, draws navbar like a #Darker R, G, B, a #define MAIN_COLOR_COMPONENTS {0.153 , 0.306, 0.553, 1.0, 0.122, 0.247, 0.482, 1.0} #define LIGHT_COLOR_COMPONENTS {0.478, 0.573, 0.725, 1.0, 0.216, 0.357, 0.584, 1.0} @implementation UINavigationBar (UINavigationBarCategory) - drawRect (zero): (CGRect) Rect {ifReady} {UIImage * img = [UIImage imageNamed: @ "navigation_background.png"]; [IMG DryNricket: CGRactMake (0, 0, self-frame size, width, self-frame size. Hight)]; } Other {// here instead simulate // You must adjust MAIN_COLOR_COMPONENTS and LIGHT_COLOR_COMPONENTS to match your app // color bar presents CGContextRef reference = UIGraphicsGetCurrentContext (); CGFloat locations [2] = {0.0, 1.0}; CGColorSpaceRef myColorSpace = CGColorSpaceCreateDeviceRGB (); CGFloat Top End [8] = LIGHT_COLOR_COMPONENTS; CGGradientRef topgradients = CGGradientCreateWithColorComponents (myColorspace, topComponents, Places, 2); CGContextDrawLinearGradient (reference, topGradient, CGPointMake (0, 0), CGPointMake (0, self.frame.size.height / 2), 0); CGGradientRelease (topGradient); CGFloat botComponents [8] = MAIN_COLOR_COMPONENTS; CGGradientRef botGradient = CGGradientCreateWithColorComponents (myColorspace, botComponents, Places, 2); CGContextDrawLinearGradient (reference, botGradient, CGPointMake (0, self.frame.size.height / 2), CGPointMake (0, self.frame.size.height), 0); CGGradientRelease (botGradient); CGColorSpaceRelease (myColorspace); // Top Line CGContextSetRGBStrokeColor (Reference, 1, 1, 1, 1.0); CGContextMoveToPoint (reference, 0, 0); CGContextAddLineToPoint (references, self.frame.size.width, 0); CGContextStrokePath (reference); // bottom line CGContextSetRGBStrokeColor (Reference, 0, 0, 0, 1.0); CGContextMoveToPoint (Reference, 0, self.frame.size.height); CGContextAddLineToPoint (references, self.frame.size.width, self.frame.size.height); CGContextStrokePath (reference); }} @end  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -