iOS 掃描上的層及其樣式(一)

首先在一個view上扣出一個區域,顯示下層view的方法


UIView *v1 = [[UIViewalloc]initWithFrame:self.view.bounds];

    

    [v1 setBackgroundColor:[UIColorblackColor]];

    

    [v1setAlpha:0.8f];

    

    [self.viewaddSubview:v1];

    

    //通過貝賽爾曲線來切出這個口

    UIBezierPath *path = [UIBezierPathbezierPathWithRect:CGRectMake(0,0,self.pageSize.width,self.pageSize.height)];

    

    [path appendPath:[[UIBezierPathbezierPathWithRoundedRect:self.rectangleRectcornerRadius:1]bezierPathByReversingPath ]];

    

    CAShapeLayer *shapeLayer = [CAShapeLayerlayer];

    

    shapeLayer.path = path.CGPath;

    

    [v1.layersetMask:shapeLayer];


注:這段代碼實現了當中的框。其他請先無視。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章