Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

TransparentNavigationBar

Simple way to make default navigation bar transparent.

Just add these line to your AppDelegate class's didFinishLaunchingWithOptions function.

var imageForDefault = self.imageWithColor(UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.0))
var imageForCompact = self.imageWithColor(UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.0)) 
UINavigationBar.appearance().setBackgroundImage(imageForDefault, forBarMetrics: UIBarMetrics.Default) 
UINavigationBar.appearance().setBackgroundImage(imageForCompact, forBarMetrics: UIBarMetrics.Compact)

Function I used to make an image is

func imageWithColor(color: UIColor) -> UIImage{
	let rect:CGRect = CGRectMake(0, 0, 1, 1);
	UIGraphicsBeginImageContextWithOptions(rect.size, false, 0);
	color.setFill()
	UIRectFill(rect)
	let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()
	return image;
}

About

Simple way to make default navigation bar transparent.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages