Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

UIView分类,OC、swift双语,自由添加四周边框,颜色粗细随心所欲(^_^)

Notifications You must be signed in to change notification settings

bb-coder/BHBFreeBorder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

4 Commits

Repository files navigation

BHBFreeBorder

UIView分类,OC、swift双语,自由添加四周边框,颜色粗细随心所欲(^_^)

###效果图 效果图

###使用方法

####1.导入UIView+BHBFreeBorder分类

####2.添加单根边框,例如只加右边框

OC:

 /// 单根边框
 UILabel * lbl2 = [[UILabel alloc] init];
 lbl2.frame = CGRectMake(50, 250, 100, 50);
 [self.view addSubview:lbl2];
 [lbl2 addBorderLayerWithColor:[UIColor greenColor] size:1 borderType:BorderTypeRight];

swift:

/// 单根边框
 let lbl2:UILabel = UILabel()
 lbl2.frame = CGRectMake(50, 250, 100, 50)
 self.view.addSubview(lbl2)
 lbl2.addBorderLayer(UIColor.greenColor(), size: 1, boderType: BorderType.right);

####3.添加n根边框,代码如下:

OC:

 /// 下上左边框
 UILabel * lbl = [[UILabel alloc] init];
 lbl.frame = CGRectMake(50, 50, 100, 50);
 [self.view addSubview:lbl];
 [lbl addBorderWithColor:[UIColor redColor] size:1 borderTypes:@[@(BorderTypeBottom),@(BorderTypeTop),@(BorderTypeLeft)]];
 /// 下上右边框
 UILabel * lbl1 = [[UILabel alloc] init];
 lbl1.frame = CGRectMake(50, 150, 100, 50);
 [self.view addSubview:lbl1];
 [lbl1 addBorderWithColor:[UIColor redColor] size:1 borderTypes:@[@(BorderTypeBottom),@(BorderTypeTop),@(BorderTypeRight)]];

swift:

 /// 下上左边框
 let lbl:UILabel = UILabel()
 lbl.frame = CGRectMake(50, 50, 100, 50)
 self.view.addSubview(lbl)
 lbl.addBorder(UIColor.redColor(), size: 1, borderTypes: [BorderType.bottom.rawValue,BorderType.top.rawValue,BorderType.left.rawValue])
 /// 下上右边框
 let lbl1:UILabel = UILabel()
 lbl1.frame = CGRectMake(50, 150, 100, 50)
 self.view.addSubview(lbl1)
 lbl1.addBorder(UIColor.redColor(), size: 1, borderTypes: [BorderType.bottom.rawValue,BorderType.top.rawValue,BorderType.right.rawValue])

####大家玩的开心,good luck!

About

UIView分类,OC、swift双语,自由添加四周边框,颜色粗细随心所欲(^_^)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /