go 语言中的结构体方法结构体名称的大小写有着不同的意义: 小写表示不能被别的包访问package mainimport "fmt"type Rect struct { width,height int}func (r *Rect) area() int { return r.width*r.hei...
分类:
编程语言 时间:
2015-07-10 12:53:15
阅读次数:
141
方法一:利用偏移量来滚动- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated;方法二:利用rect来滚动- (void)scrollRectToVisible:(CGRect)rect animated:(BO...
分类:
其他好文 时间:
2015-07-08 02:04:44
阅读次数:
500
1.实线,(下划线/删除线)
写一个新类 UnderLineLabel :
UILabel
- (void)drawRect:(CGRect)rect {
// Drawing code
[super drawRect:rect];
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGSize f...
分类:
移动开发 时间:
2015-07-07 11:08:01
阅读次数:
253
1、代码2、运行1、代码 1 package main 2 3 import "fmt" 4 5 type Rect struct { 6 x, y float64 7 width, height float64 8 } 9 10 func (r * Rect) Area() f...
分类:
编程语言 时间:
2015-07-06 22:59:48
阅读次数:
180
UIColor 转UIImage
- (UIImage*) createImageWithColor: (UIColor*) color
{
CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef c...
分类:
其他好文 时间:
2015-07-05 16:55:50
阅读次数:
160
可用以下代码:UIGraphicsBeginImageContextWithOptions(size, opaque, scale);// code[view drawViewHierarchyInRect:rect afterScreenUpdates:YesOrNo];UIImage *imag...
分类:
移动开发 时间:
2015-07-05 07:02:39
阅读次数:
160
可以利用 CGMutablePathRef 创建每个不同图形,然后再一起添加到CGContext中- (void)drawRect:(CGRect)rect{ CGContextRef ctx = UIGraphicsGetCurrentContext(); //一、 画线 ...
分类:
Web程序 时间:
2015-07-02 20:48:18
阅读次数:
151
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
UIBezierPath *path = [UI...
分类:
移动开发 时间:
2015-07-01 22:19:53
阅读次数:
259
#import "LCSView.h"
@implementation LCSView
////绘图
- (void)drawRect:(CGRect)rect
{
#if 0
//图形上下文对象
CGContextRef context = UIGraphicsGetCurrentContext();
...
分类:
移动开发 时间:
2015-06-30 18:21:10
阅读次数:
221
这里列出一种在窗口Window中画图的程序框架。。。。。。。。。。#-*- coding:utf-8 -*-from pyglet.gl import *def draw_rect(x, y, width, height): glBegin(GL_LINE_LOOP) glVertex2...
分类:
其他好文 时间:
2015-06-27 22:41:01
阅读次数:
1012