绘制波形图

简介:

绘制波形图

 

效果

 

源码

https://github.com/YouXianMing/Animations


//
//  DrawWaveViewController.m
//  Animations
//
//  Created by YouXianMing on 15/12/5.
//  Copyright © 2015年 YouXianMing. All rights reserved.
//

#import "DrawWaveViewController.h"
#import "WxHxD.h"
#import "DrawView.h"
#import "DrawLineView.h"
#import "UIView+SetRect.h"

@interface DrawWaveViewController ()

@property (nonatomic, strong) DrawView       *drawView;
@property (nonatomic, strong) DrawLineView   *drawLineView;
@property (nonatomic, strong) CADisplayLink  *displayLink;

@end

@implementation DrawWaveViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
}

- (void)setup {

    [super setup];
    
    self.drawView        = [[DrawView alloc] initWithFrame:CGRectMake(0, 0, Width, 200)];
    self.drawView.center = self.view.center;
    self.drawView.y     += 100;
    [self.view addSubview:self.drawView];
    
    self.drawLineView        = [[DrawLineView alloc] initWithFrame:CGRectMake(0, 0, Width, 200)];
    self.drawLineView.center = self.view.center;
    self.drawLineView.y     -= 100;
    [self.view addSubview:self.drawLineView];
    
    self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(drawEvent)];
    [self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
    
    [self bringTitleViewToFront];
}

- (void)drawEvent {
    
    [self.drawView setNeedsDisplay];
    [self.drawLineView setNeedsDisplay];
}

@end

细节


目录
相关文章
|
3月前
threeJs绘制曲线
这篇文章讲解了如何使用Three.js中的CatmullRomCurve3来绘制平滑的曲线,并提供了实现的代码示例。
47 3
threeJs绘制曲线
|
3月前
ThreeJs绘制线
这篇文章详细说明了如何使用Three.js来绘制线条,包括创建线几何体、设置材质以及将线条添加到3D场景中的具体步骤。
55 1
|
4月前
|
图形学
利用Graphics画出一幅图表绘制折线图
("某工厂某产品年度销售额图表",this.Font, Brushes.Black, new Point(420,14)); pen.Dispose();
32 0
|
8月前
|
Python
绘制直线
【5月更文挑战第11天】绘制直线。
41 1
|
8月前
用贝舍尔曲线绘制分段闭合圆环
用贝舍尔曲线绘制分段闭合圆环
42 0
|
C++ Python
C++ VTK鼠标网格表面绘制曲线
C++ VTK鼠标网格表面绘制曲线
496 0
C++ VTK鼠标网格表面绘制曲线
|
C# 图形学
C#之深入理解GDI+绘制圆弧及圆角矩形等比缩放的绘制
GDI+中对于圆弧的绘制,是以给定的长方形(Rectangle`结构)为边界绘制的椭圆的一部分形成的圆弧。绘制的圆弧的中心为长方形内切椭圆的圆心(如果是正方形,则正方形的...
658 0
C#之深入理解GDI+绘制圆弧及圆角矩形等比缩放的绘制
110.绘制彩色抛物线
110.绘制彩色抛物线
111 0