相关疑难解决方法(0)

在代码生成的UIView上绘制UIBezierPath

UIView在运行时添加了代码.

我想画一个UIBezierPath,但这是否意味着我必须覆盖drawRectUIView?

或者是否有其他方式在定制上绘制它UIView

以下是生成以下内容的代码UIView:

UIView* shapeView = [[UIView alloc]initWithFrame:CGRectMake(xOrigin,yOrigin+(i*MENU_BLOCK_FRAME_HEIGHT), self.shapeScroll.frame.size.width, MENU_BLOCK_FRAME_HEIGHT)];
shapeView.clipsToBounds = YES;
Run Code Online (Sandbox Code Playgroud)

以下是创建和返回的函数UIBezierPath:

- (UIBezierPath*)createPath
{
    UIBezierPath* path = [[UIBezierPath alloc]init];
    [path moveToPoint:CGPointMake(100.0, 50.0)];
    [path addLineToPoint:CGPointMake(200.0,50.0)];
    [path addLineToPoint:CGPointMake(200.0, 200.0)];
    [path addLineToPoint:CGPointMake(100.0, 200.0)];
    [path closePath];
    return path;
}
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uiview ios uibezierpath

63
推荐指数
4
解决办法
6万
查看次数

标签 统计

ios ×1

iphone ×1

objective-c ×1

uibezierpath ×1

uiview ×1