UIView截图- (UIImage *)captureView:(UIView *)theView{ CGRect rect = theView.frame; if ([theView isKindOfClass:[UIScrollView class]]) { rect...
分类:
移动开发 时间:
2015-05-26 10:33:37
阅读次数:
166
CGFloat:?浮点值的基本类型
CGPoint:?表示一个二维坐标系中的点
CGSize:?表示一个矩形的宽度和高度
CGRect:?表示一个矩形的位置和大小
typedef?float?CGFloat;//?32-bit
typedef?double?CGFloat;//?64-...
分类:
其他好文 时间:
2015-05-24 23:43:14
阅读次数:
305
上一节中,我引用别人的文章,详细的讲解了Quartz 2D的基本概念。想了解的,请点击这里。这一节用几个小Demo,来说明Quartz 2D的绘图功能。
1. 我们先定义一个用来绘图的View(DrawView,它继承自UIView),并准备在下面的方法中实现绘图工作。
- (void)drawRect:(CGRect)rect;
2. 在主界面上面拖拽一个View,并且将...
分类:
其他好文 时间:
2015-05-24 10:13:55
阅读次数:
132
UIButton1 //1.设置UIButton 的左右移动2 .center属性 获得 CGPoint 来修改x y3 //1.设置UIButton 的放大缩小4 bounds属性 获得CGRect 然后通过size.height设置高 wight设置宽 //3.或者使用frame 来设...
分类:
移动开发 时间:
2015-05-21 12:34:45
阅读次数:
131
自定义UITextView文字字体时,经常出现光标与字体的高度不匹配,可以通过下面代码修改默认的光标高度,//创建子类重写UITextView方法- (CGRect)caretRectForPosition:(UITextPosition *)position{ CGRect original...
分类:
其他好文 时间:
2015-05-18 22:22:47
阅读次数:
136
1、根据一个矩形画曲线+ (UIBezierPath*)bezierPathWithRect:(CGRect)rect2、根据矩形框的内切圆画曲线+ (UIBezierPath*)bezierPathWithOvalInRect:(CGRect)rect3、根据矩形画带圆角的曲线+ (UIBezie...
分类:
其他好文 时间:
2015-05-18 18:33:27
阅读次数:
124
- (id)initWithFrame:(CGRect)aRect //通过一个矩形对象初始化Configuring a View’s Visual Appearance //配置视觉展示@property(nonatomic, copy) UIColor *backgroundColor //设置...
分类:
其他好文 时间:
2015-05-17 18:37:45
阅读次数:
88
[self setNeedsDisplay];//重新调drawRect- (void)drawRect:(CGRect)rect { //do sth}[self setNeedsLayout];//重新调layoutSubviews- (void)layoutSubviews{ [super l...
分类:
其他好文 时间:
2015-05-17 10:35:34
阅读次数:
131
1 @interface UIView : UIResponder 2 3 /** 4 * 通过一个frame来初始化一个UI控件 5 */ 6 - (id)initWithFrame:(CGRect)frame; 7 8 // YES:能够跟用户进行交互 9 @pro...
分类:
其他好文 时间:
2015-05-15 10:20:43
阅读次数:
173
1. UIView的基本用法 //打印屏幕的宽和高 CGRect screenBounds = [[UIScreen mainScreen] bounds]; NSLog(@"%f, %f", screenBounds.size.width, screenBounds.size.h...
分类:
其他好文 时间:
2015-05-12 01:40:04
阅读次数:
138