Skip to content

CreaterOS/ShieldsUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shields

Codacy Badge standard-readme compliant standard-readme compliant standard-readme compliant standard-readme compliant

Introduction

Customize the personalized badge effect with simple configuration.

build status service-test status coverage Total alerts chat on Discord

Use

1. Config Label text and Message text -- Default / Logo

Objective-C

Shields *shields = [[Shields alloc] initWithFrame:CGRectMake(0, 0, 320, 40) style:ShieldsDefault];
[shields configLabel:@"CreaterOS" message:@"v1.0"];
shields.center = self.view.center;
[self.view addSubview:shields];

Swift

let shields = Shields(frame: CGRect(x: 0, y: 0, width: 320, height: 40), style: .ShieldsDefault)
shields.cornerRadius = 20
shields.configLabel(label: "CreaterOS", message: "v1.0")
shields.center = self.view.center
view.addSubview(shields)

2. Config Label Font Color -- Default / Logo

Objective-C

Shields *shields = [[Shields alloc] initWithFrame:CGRectMake(0, 0, 320, 40) style:ShieldsDefault];
[shields configLabel:@"CreaterOS" message:@"v1.0" labelColor:[UIColor colorWithRed: 86/255.0 green: 88/255.0 blue: 224/255.0 alpha:1.000]];
shields.center = self.view.center;
[self.view addSubview:shields];

Swift

let shields = Shields(frame: CGRect(x: 0, y: 0, width: 320, height: 40), style: .ShieldsDefault)
shields.cornerRadius = 20
shields.configLabel(label: "CreaterOS", message: "v1.0", labelColor: UIColor(red: 86/255.0, green: 88/255.0, blue: 224/255.0, alpha: 1.0))
shields.center = self.view.center
view.addSubview(shields)

3. Config Message Font Color -- Default / Logo

Objective-C

Shields *shields = [[Shields alloc] initWithFrame:CGRectMake(0, 0, 320, 40) style:ShieldsDefault];
[shields configLabel:@"CreaterOS" message:@"v1.0" messageColor:[UIColor colorWithRed: 86/255.0 green: 88/255.0 blue: 224/255.0 alpha:1.000]];
shields.center = self.view.center;
[self.view addSubview:shields];

Swift

let shields = Shields(frame: CGRect(x: 0, y: 0, width: 320, height: 40), style: .ShieldsDefault)
shields.cornerRadius = 20
shields.configLabel(label: "CreaterOS", message: "v1.0", messageColor: UIColor(red: 86/255.0, green: 88/255.0, blue: 224/255.0, alpha: 1.0))
shields.center = self.view.center
view.addSubview(shields)

4.Config Label Background Color -- Default / Logo

Objective-C

Shields *shields = [[Shields alloc] initWithFrame:CGRectMake(0, 0, 320, 40) style:ShieldsDefault];
[shields configLabel:@"CreaterOS" message:@"v1.0" labelBackgroundColor:[UIColor colorWithRed: 241/255.0 green: 176/255.0 blue: 101/255.0 alpha:1.000]];
shields.center = self.view.center;
[self.view addSubview:shields];

Swift

let shields = Shields(frame: CGRect(x: 0, y: 0, width: 320, height: 40), style: .ShieldsDefault)
shields.cornerRadius = 20
shields.configLabel(label: "CreaterOS", message: "v1.0", labelBackgroundColor: UIColor(red: 241/255.0, green: 176/255.0, blue: 101/255.0, alpha: 1.0))
shields.center = self.view.center
view.addSubview(shields)

5.Config Message Background Color -- Default / Logo

Objective-C

Shields *shields = [[Shields alloc] initWithFrame:CGRectMake(0, 0, 320, 40) style:ShieldsDefault];
[shields configLabel:@"CreaterOS" message:@"v1.0" messageBackgroundColor:[UIColor colorWithRed: 241/255.0 green: 176/255.0 blue: 101/255.0 alpha:1.000]];
shields.center = self.view.center;
[self.view addSubview:shields];

Swift

let shields = Shields(frame: CGRect(x: 0, y: 0, width: 320, height: 40), style: .ShieldsDefault)
shields.cornerRadius = 20
shields.configLabel(label: "CreaterOS", message: "v1.0", messageBackgroundColor: UIColor(red: 241/255.0, green: 176/255.0, blue: 101/255.0, alpha: 1.0))
shields.center = self.view.center
view.addSubview(shields)

6.Config Label And Message Background Color -- Default / Logo

Objective-C

Shields *shields = [[Shields alloc] initWithFrame:CGRectMake(0, 0, 320, 40) style:ShieldsDefault];
[shields configLabel:@"CreaterOS" message:@"v1.0" labelBackgroundColor:[UIColor colorWithRed: 241/255.0 green: 176/255.0 blue: 101/255.0 alpha:1.000] messageBackgroundColor:[UIColor colorWithRed: 86/255.0 green: 88/255.0 blue: 224/255.0 alpha:1.000]];
shields.center = self.view.center;
[self.view addSubview:shields];

Swift

let shields = Shields(frame: CGRect(x: 0, y: 0, width: 320, height: 40), style: .ShieldsDefault)
shields.cornerRadius = 20
shields.configLabel(label: "CreaterOS", message: "v1.0", labelBackgroundColor: UIColor(red: 241/255.0, green: 176/255.0, blue: 101/255.0, alpha: 1.0), messageBackgroundColor: UIColor(red: 88/255.0, green: 88/255.0, blue: 101/255.0, alpha: 1.0))
shields.center = self.view.center
view.addSubview(shields)

7.Config Label And Message -- Default / Logo

Objective-C

Shields *shields = [[Shields alloc] initWithFrame:CGRectMake(0, 0, 320, 40) style:ShieldsDefault];
[shields configLabel:@"CreaterOS" message:@"v1.0" labelBackgroundColor:[UIColor colorWithRed: 86/255.0 green: 88/255.0 blue: 224/255.0 alpha:1.000] messageBackgroundColor:[UIColor colorWithRed: 241/255.0 green: 176/255.0 blue: 101/255.0 alpha:1.000] labelColor:UIColor.whiteColor messageColor:UIColor.whiteColor];
shields.center = self.view.center;
[self.view addSubview:shields];

Swift

let shields = Shields(frame: CGRect(x: 0, y: 0, width: 320, height: 40), style: .ShieldsDefault)
shields.cornerRadius = 20
shields.configLabel(label: "CreaterOS", message: "v1.0", labelBackgroundColor: UIColor(red: 241/255.0, green: 176/255.0, blue: 101/255.0, alpha: 1.0), messageBackgroundColor: UIColor(red: 88/255.0, green: 88/255.0, blue: 101/255.0, alpha: 1.0), labelColor: .white, messageColor: .white)
shields.center = self.view.center
view.addSubview(shields)

8. Config Logo

Objective-C

Shields *shields = [[Shields alloc] initWithFrame:CGRectMake(0, 0, 320, 40) style:ShieldsLogo];
[shields configLabel:@"CreaterOS" message:@"v1.0" labelBackgroundColor:[UIColor colorWithRed: 241/255.0 green: 176/255.0 blue: 101/255.0 alpha:1.000] messageBackgroundColor:[UIColor colorWithRed: 193/255.0 green: 241/255.0 blue: 172/255.0 alpha:1.000] labelColor:[UIColor colorWithRed: 242/255.0 green: 242/255.0 blue: 246/255.0 alpha:1.000] messageColor:[UIColor colorWithRed: 242/255.0 green: 242/255.0 blue: 246/255.0 alpha:1.000] logo:[UIImage imageNamed:@"lanmei"] logoWidth:15 logoPosition:CGPointMake(10, 10)];
shields.center = self.view.center;
[self.view addSubview:shields];

Swift

let shields = Shields(frame: CGRect(x: 0, y: 0, width: 320, height: 40), style: .ShieldsLogo)
shields.cornerRadius = 20
shields.configLabel(label: "CreaterOS", message: "v1.0", labelBackgroundColor: UIColor(red: 241/255.0, green: 176/255.0, blue: 101/255.0, alpha: 1.0), messageBackgroundColor: UIColor(red: 88/255.0, green: 88/255.0, blue: 101/255.0, alpha: 1.0), labelColor: .white, messageColor: .white, logo: UIImage(named: "lanmei"), logoWidth: 25.0, logoPosition: CGPoint(x: 15, y: 15))
shields.center = self.view.center
view.addSubview(shields)

9. Json Config

{
	"schemaVersion":1,
	"label":"CreaterOS",
	"message":"v1.0",
	"labelBackgroundColor":{
		"hex":"#8174D9",
		"alpha":0.7
	},
	"messageBackgroundColor":{
		"hex":"#81EBD9",
		"alpha":0.7
	},
	"labelColor":{
		"hex":"#B82B1D",
		"alpha":1
	},
	"messageColor":{
		"hex":"#FFFFFF",
		"alpha":1
	},
	"logoName":"lanmei",
	"logoWidth":25,
	"logoPosition":{
		"X":17,
		"Y":20
	}
}

Objective-C

Shields *shields = [[Shields alloc] initWithFrame:CGRectMake(0, 0, 320, 40) style:ShieldsLogo];
[shields configWithJsonFilePath:[[NSBundle mainBundle] pathForResource:@"shields" ofType:@"json"]];
shields.center = self.view.center;
[self.view addSubview:shields];

Swift

let shields = Shields(frame: CGRect(x: 0, y: 0, width: 320, height: 40), style: .ShieldsLogo)
shields.cornerRadius = 20
shields.configWithJsonFilePath(jsonPath: Bundle.main.path(forResource: "shields", ofType: "json")!)
shields.center = self.view.center
view.addSubview(shields)

MIT License

MIT License

Stargazers

Stargazers repo roster for @CreaterOS/shields

Forkers

Forkers repo roster for @CreaterOS/shields

Contribute to this project

If you have a feature request or bug report, please feel free to send 863713745@qq.com to upload the problem, and we will provide you with revisions and help as soon as possible. Thank you very much for your support.

Security Disclosure

If you have found the Shields security vulnerabilities and vulnerabilities that need to be modified, you should email them to 863713745@qq.com as soon as possible. thank you for your support.