您的位置:首页 > 产品设计 > UI/UE

iOS基本图形绘制--UIBezierPath

2016-05-15 20:01 411 查看

BasicGraphics

iOS基本图形绘制, 包括: 线, 弧线, 三角形, 椭圆, 矩形, 圆角矩形, 贝塞尔曲线等. 效果如下图:



UIBezierPath

官方参考: UIBezierPath

工程剽窃自: [iPhone] UIBezierPath 図形の描画 (Objective-C)

可以创建的UIBezierPath对象有:

+ bezierPath
+ bezierPathWithRect:
+ bezierPathWithOvalInRect:
+ bezierPathWithRoundedRect:cornerRadius:
+ bezierPathWithRoundedRect:byRoundingCorners:cornerRadii:
+ bezierPathWithArcCenter:radius:startAngle:endAngle:clockwise:
+ bezierPathWithCGPath:
- bezierPathByReversingPath


CoreGraphics

这是另一种更加底层的绘制方法.

深色背景下设置标题栏为白色

背景色为黑色, 需设置状态栏(显示信号, 时间, 电量等)为亮色, 有两种方法:

Info.plist添加View controller-based status bar appearance, 设置value为NO. 添加

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];


ViewController.m中实现 - (UIStatusBarStyle) preferredStatusBarStyle 方法

- (UIStatusBarStyle) preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}


并且在ViewController.m中调用此方法.

[self preferredStatusBarStyle];


(注意删掉Info.plist中的View controller-based status bar appearance项)

Github

BasicGraphics
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: