iOS开发基础知识--碎片18 1:initWithFrame方法的理解 1. initWithFrame方法是什么? initWithFrame方法用来初始化并返回一个新的视图对象,根据指定的CGRect(尺寸)。 当然,其他UI对象,也有initWithFrame方法,但是,我们以UIView为 ...
分类:
移动开发 时间:
2016-08-22 16:13:03
阅读次数:
213
UIView : UIResponder<nscoding, uidynamicitem="" uiappearancecontainer,="" uiappearance,=""> /** * 通过一个frame来初始化一个UI控件 */ - (id)initWithFrame:(CGRect)f ...
分类:
其他好文 时间:
2016-08-19 19:03:57
阅读次数:
151
#import "XZCTextField.h"@implementation XZCTextField////控制清除按钮的位置//-(CGRect)clearButtonRectForBounds:(CGRect)bounds//{// return CGRectMake(bounds.orig ...
分类:
其他好文 时间:
2016-08-17 11:57:26
阅读次数:
156
UIColor 转UIImage(可将该方法作为一个UIImage的分类) - (UIImage *)imageWithColor:(UIColor *)color { //描述一个矩形 CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); //开启图形 ...
分类:
移动开发 时间:
2016-08-10 22:43:48
阅读次数:
294
一、关于矩阵操作 1.画一个四边形 通过设置两个端点(长和宽)来完成一个四边形的绘制。 代码: 1 - (void)drawRect:(CGRect)rect 2 { 3 // 画四边形 4 // 获取图形上下文 5 CGContextRef ctx = UIGraphicsGetCurrentCo ...
分类:
移动开发 时间:
2016-08-10 14:18:40
阅读次数:
156
//头部拉伸效果 - (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGPoint point = scrollView.contentOffset; if (point.y < -kHEIGHT) { CGRect rect = [s ...
分类:
其他好文 时间:
2016-08-10 12:29:05
阅读次数:
144
class MyView: UIView { var lView:UIView! var time:NSTimer! override init(frame: CGRect) { super.init(frame: frame) //开启多点触控 self.multipleTouchEnabled ...
分类:
编程语言 时间:
2016-08-01 17:41:18
阅读次数:
350
import UIKit class ViewController:UIViewController { overridefunc viewDidLoad() { super.viewDidLoad() let textview = UITextView(frame:CGRect(x: 10,y: ...
分类:
编程语言 时间:
2016-07-24 13:28:39
阅读次数:
179
UIViewiosUIViewUIView的常见属性NSArray *subview;所有的子控件数组中元素的顺序决定着子控件的显示层级顺序(下标越大,越显示在屏幕的上面)@property(nonautomic) CGRect frame;控件矩形框在父控件中的位置和尺寸(以父控件的左上角为坐标原... ...
分类:
其他好文 时间:
2016-07-23 18:24:23
阅读次数:
187
- (void)drawTextInRect:(CGRect)rect { CGSize shadowOffset = self.shadowOffset; UIColor *textColor = self.textColor; CGContextRef c = UIGraphicsGetCurr ...
分类:
移动开发 时间:
2016-07-22 21:13:09
阅读次数:
273