橫線和豎線(分割線)
阿新 • • 發佈:2019-02-14
橫線:
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;
}