1. 程式人生 > >橫線和豎線(分割線)

橫線和豎線(分割線)

橫線:

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;
}

娛樂