1. 程式人生 > >iOS基本圖形繪製--UIBezierPath

iOS基本圖形繪製--UIBezierPath

BasicGraphics

iOS基本圖形繪製, 包括: 線, 弧線, 三角形, 橢圓, 矩形, 圓角矩形, 貝塞爾曲線等. 效果如下圖:
wf9

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