IOS上怎样画出1像素的线

#define SINGLE_LINE_WIDTH (1/[UIScreen mainScreen].scale)

#define SINGLE_LINE_ADJUST_OFFSET ((1/[UIScreen mainScreen].scale)/2)


- (void)viewDidLoad {

    [super viewDidLoad];

    // Do any additional setup after loading the view, typically from a nib.

    CGFloat xPos = 100;

    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(xPos - SINGLE_LINE_ADJUST_OFFSET, 35, SINGLE_LINE_WIDTH, 330)];

    view.backgroundColor = [UIColor blackColor];

    [self.view addSubview:view];

    

}


posted @ 2016-01-09 14:47  zfyouxi  阅读(115)  评论(0编辑  收藏  举报