- (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); //起点移动到(0,0) CGContextMoveToPoint(context, 0, 0); //画线到(100,...
分类:
其他好文 时间:
2014-09-22 22:22:23
阅读次数:
208
一、重写 DrwaRect-(void)drawRect:(CGRect)rect{ CGRect bounds = self.bounds; CGPoint center; center.x = bounds.origin.x + bounds.size.width / ...
分类:
其他好文 时间:
2014-09-16 14:12:50
阅读次数:
200
windows 随机矩形绘制
代码如下
#include
void DrawRect (HWND hwnd);
int cxClient, cyClient;
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstan...
//当你通过代码创建控件就会调用这个方法- (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { [self setup]; } return self;}//当你通过storyboared或...
分类:
其他好文 时间:
2014-09-11 22:19:52
阅读次数:
273
//// WJView.m// zwj涂鸦//// Created by zwj on 14-9-9.// Copyright (c) 2014年 zwj. All rights reserved.//#import "WJView.h"@interface WJView()@property(no...
分类:
其他好文 时间:
2014-09-11 20:47:32
阅读次数:
183
自定义一个View DrawLineDrawLine.h#import @protocol gridTouchDelete - (void)gridTouchColumn:(NSInteger)column touchRow:(NSInteger)row;@end@interface DrawLin...
分类:
移动开发 时间:
2014-09-10 15:38:50
阅读次数:
230
1,UIView的setNeedsDisplay和setNeedsLayout方法 首先两个方法都是异步执行的。而setNeedsDisplay会调用自动调用drawRect方法,这样可以拿到 UIGraphicsGetCurrentContext,就可以画画了。而setNeedsLayout会.....
分类:
其他好文 时间:
2014-09-05 21:06:01
阅读次数:
238
实现自定义View的关键是重载UIView的drawRect: 方法,因为主要是通过重载这个方法,来改变view的外观。例如:- (void)drawRect:(CGRect)rect { // 绘图 CGRect bounds = [self bounds]; // Where ...
分类:
其他好文 时间:
2014-09-05 00:53:10
阅读次数:
274
使用绘画 必须在 -(void)drawRect:(CGRect)rect 中使用例子:- (void)drawRect:(CGRect)rect{ CGContextRef context=UIGraphicsGetCurrentContext(); CGColorSpaceR...
分类:
其他好文 时间:
2014-09-02 22:36:35
阅读次数:
415
Phone重绘机制drawRect如何使用iPhone进行绘图、重绘操作iPhone的绘图操作是在UIView类的drawRect方法中完成的,所以如果我们要想在一个UIView中绘图,需要写一个扩展UIView 的类,并重写drawRect方法,在这里进行绘图操作,程序会自动调用此方法进行绘图。下...
分类:
其他好文 时间:
2014-08-30 18:54:59
阅读次数:
171