开发者

create a non-rectangular UIView

I need to create a view (a uibutton) of strange shape. Is this possible with quartz2d? i used this code for buil my UIView subclass

- (void)drawRect:(CGRect)rect {

    // Drawing code
     CGContextRef context = UIGraphicsGetCurrentContext();
     CGContextMoveToPoint(context, 100, 100);
     CGContextAddLineToPoint(context, 150, 150);
     CGContextAddLineToPoint(context, 100, 200);
     CGContextAddLineToPoint(context, 50, 150);
     CGContextAddLineToPoint(context, 100, 100);
     CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
     CGContextFillPath(context);
}

but this is a draw inside a standard U开发者_如何学PythonIView (rectangular UIView)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜