IOS - 横线和竖线(分割线)

横线:

UIView *horizontalLine = [[UIView alloc]initWithFrame:CGRectMake(x, y, viewWidth(), 1)];
horizontalLine.backgroundColor = [UIColor grayColor];
[self.view addSubview:horizontalLine];
[horizontalLine release];

竖线

UIView *verticalLine = [[UIView alloc]initWithFrame:CGRectMake(x cordinate, y cordinate, 1, viewWidth())];
verticalLine.backgroundColor = [UIColor grayColor];
[self.view addSubview:verticalLine];
[verticalLine release];

屏幕宽度

CGFloat viewWidth() {
    static CGFloat viewWidth = 0;
    if (viewWidth == 0) {
        viewWidth = CYScreenBounds().size.width;
    }

    return viewWidth;
}

IOS - 横线和竖线(分割线)_第1张图片

你可能感兴趣的:(ios,横线,Mystra,竖线)