UIStackView+Separator 增加分割线

IOS9.0以后新增控件UIStackView.项目中经常要用到分割线。下面方法能很方便给UIStackView中的控件增加分割线。

UIStackView+Separator文件下载地址:https://pan.baidu.com/s/1skZjMf7

使用方法:

#import "UIStackView+Separator.h"

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UIStackView *stackView1;

@property (weak, nonatomic) IBOutlet UIStackView *stackView2;

@end

@implementation ViewController

- (void)viewDidLoad {

[super viewDidLoad];

self.stackView1.separatorColor = [UIColor redColor];

self.stackView1.separatorLength = 10;

self.stackView2.separatorColor = [UIColor colorWithWhite:0.9 alpha:1.0];

self.stackView2.separatorLength = 100;

}

@end

效果图



你可能感兴趣的:(UIStackView+Separator 增加分割线)