iOS绘图教程
- - (void) drawRect: (CGRect) rect {
- UIBezierPath* p = [UIBezierPathbezierPathWithOvalInRect:CGRectMake(0,0,100,100)];
- [[UIColor blueColor] setFill];
- [p fill];
- }
- - (void) drawRect: (CGRect) rect {
- CGContextRef con = UIGraphicsGetCurrentContext();
- CGContextAddEllipseInRect(con, CGRectMake(0,0,100,100));
- CGContextSetFillColorWithColor(con, [UIColor blueColor].CGColor);
- CGContextFillPath(con);
- }
- @interface MyLayerDelegate : NSObject
- @end
- @implementation MyLayerDelegate
- - (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)ctx {
- UIGraphicsPushContext(ctx);
- UIBezierPath* p = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0,0,100,100)];
- [[UIColor blueColor] setFill];
- [p fill];
- UIGraphicsPopContext();
- }
- @end
- @interface MyView () {
- MyLayerDelegate* _layerDeleagete;
- }
- @end
- MyView *myView = [[MyView alloc] initWithFrame: CGRectMake(0, 0, 320, 480)];
- CALayer *myLayer = [CALayer layer];
- _layerDelegate = [[MyLayerDelegate alloc] init];
- myLayer.delegate = _layerDelegate;
- [myView.layer addSublayer:myLayer];
- [myView setNeedsDisplay]; // 调用此方法,drawLayer: inContext:方法才会被调用。
- - (void)drawLayer:(CALayer*)lay inContext:(CGContextRef)con {
- CGContextAddEllipseInRect(con, CGRectMake(0,0,100,100));
- CGContextSetFillColorWithColor(con, [UIColor blueColor].CGColor);
- CGContextFillPath(con);
- }
- UIGraphicsBeginImageContextWithOptions(CGSizeMake(100,100), NO, 0);
- UIBezierPath* p = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0,0,100,100)];
- [[UIColor blueColor] setFill];
- [p fill];
- UIImage* im = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- UIGraphicsBeginImageContextWithOptions(CGSizeMake(100,100), NO, 0);
- CGContextRef con = UIGraphicsGetCurrentContext();
- CGContextAddEllipseInRect(con, CGRectMake(0,0,100,100));
- CGContextSetFillColorWithColor(con, [UIColor blueColor].CGColor);
- CGContextFillPath(con);
- UIImage* im = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- UIImage* mars = [UIImage imageNamed:@"Mars.png"];
- CGSize sz = [mars size];
- UIGraphicsBeginImageContextWithOptions(CGSizeMake(sz.width*2, sz.height), NO, 0);
- [mars drawAtPoint:CGPointMake(0,0)];
- [mars drawAtPoint:CGPointMake(sz.width,0)];
- UIImage* im = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- UIImageView* iv = [[UIImageView alloc] initWithImage:im];
- [self.window.rootViewController.view addSubview: iv];
- iv.center = self.window.center;
- UIImage* mars = [UIImage imageNamed:@"Mars.png"];
- CGSize sz = [mars size];
- UIGraphicsBeginImageContextWithOptions(CGSizeMake(sz.width*2, sz.height*2), NO, 0);
- [mars drawInRect:CGRectMake(0,0,sz.width*2,sz.height*2)];
- [mars drawInRect:CGRectMake(sz.width/2.0, sz.height/2.0, sz.width, sz.height) blendMode:kCGBlendModeMultiply alpha:1.0];
- UIImage* im = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- UIImage* mars = [UIImage imageNamed:@"Mars.png"];
- CGSize sz = [mars size];
- UIGraphicsBeginImageContextWithOptions(CGSizeMake(sz.width/2.0, sz.height), NO, 0);
- [mars drawAtPoint:CGPointMake(-sz.width/2.0, 0)];
- UIImage* im = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- UIImage* mars = [UIImage imageNamed:@"Mars.png"];
- // 抽取图片的左右半边
- CGSize sz = [mars size];
- CGImageRef marsLeft = CGImageCreateWithImageInRect([mars CGImage],CGRectMake(0,0,sz.width/2.0,sz.height));
- CGImageRef marsRight = CGImageCreateWithImageInRect([mars CGImage],CGRectMake(sz.width/2.0,0,sz.width/2.0,sz.height));
- // 将每一个CGImage绘制到图形上下文中
- UIGraphicsBeginImageContextWithOptions(CGSizeMake(sz.width*1.5, sz.height), NO, 0);
- CGContextRef con = UIGraphicsGetCurrentContext();
- CGContextDrawImage(con, CGRectMake(0,0,sz.width/2.0,sz.height), marsLeft);
- CGContextDrawImage(con, CGRectMake(sz.width,0,sz.width/2.0,sz.height), marsRight);
- UIImage* im = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- // 记得释放内存,ARC在这里无效
- CGImageRelease(marsLeft);
- CGImageRelease(marsRight);
- CGImageRef flip (CGImageRef im) {
- CGSize sz = CGSizeMake(CGImageGetWidth(im), CGImageGetHeight(im));
- UIGraphicsBeginImageContextWithOptions(sz, NO, 0);
- CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, sz.width, sz.height), im);
- CGImageRef result = [UIGraphicsGetImageFromCurrentImageContext() CGImage];
- UIGraphicsEndImageContext();
- return result;
- }
- CGContextDrawImage(con, CGRectMake(0,0,sz.width/2.0,sz.height), flip(marsLeft));
- CGContextDrawImage(con, CGRectMake(sz.width,0,sz.width/2.0,sz.height), flip(marsRight));
- UIImage* mars = [UIImage imageNamed:@"Mars.png"];
- CGSize sz = [mars size];
- // 转换CGImage并使用对应的CGImage尺寸截取图片的左右部分
- CGImageRef marsCG = [mars CGImage];
- CGSize szCG = CGSizeMake(CGImageGetWidth(marsCG), CGImageGetHeight(marsCG));
- CGImageRef marsLeft = CGImageCreateWithImageInRect(marsCG,CGRectMake(0,0,szCG.width/2.0,szCG.height));
- CGImageRef marsRight = CGImageCreateWithImageInRect(marsCG, CGRectMake(szCG.width/2.0,0,szCG.width/2.0,szCG.height));
- UIGraphicsBeginImageContextWithOptions(CGSizeMake(sz.width*1.5, sz.height), NO, 0);
- //剩下的和之前的代码一样,修复倒置问题
- CGContextRef con = UIGraphicsGetCurrentContext();
- CGContextDrawImage(con, CGRectMake(0,0,sz.width/2.0,sz.height),flip(marsLeft));
- CGContextDrawImage(con, CGRectMake(sz.width,0,sz.width/2.0,sz.height),flip(marsRight));
- UIImage* im = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- CGImageRelease(marsLeft);
- CGImageRelease(marsRight);
- UIImage* mars = [UIImage imageNamed:@"Mars.png"];
- CGSize sz = [mars size];
- CGImageRef marsCG = [mars CGImage];
- CGSize szCG = CGSizeMake(CGImageGetWidth(marsCG), CGImageGetHeight(marsCG));
- CGImageRef marsLeft = CGImageCreateWithImageInRect(marsCG, CGRectMake(0,0,szCG.width/2.0,szCG.height));
- CGImageRef marsRight = CGImageCreateWithImageInRect(marsCG, CGRectMake(szCG.width/2.0,0,szCG.width/2.0,szCG.height));
- UIGraphicsBeginImageContextWithOptions(CGSizeMake(sz.width*1.5, sz.height), NO, 0);
- [[UIImage imageWithCGImage:marsLeft scale:[mars scale] orientation:UIImageOrientationUp] drawAtPoint:CGPointMake(0,0)];
- [[UIImage imageWithCGImage:marsRight scale:[mars scale] orientation:UIImageOrientationUp] drawAtPoint:CGPointMake(sz.width,0)];
- UIImage* im = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- CGImageRelease(marsLeft); CGImageRelease(marsRight);
- UIImage* moi = [UIImage imageNamed:@"Mars.jpeg"];
- CIImage* moi2 = [[CIImage alloc] initWithCGImage:moi.CGImage];
- CIFilter* grad = [CIFilter filterWithName:@"CIRadialGradient"];
- CIVector* center = [CIVector vectorWithX:moi.size.width / 2.0 Y:moi.size.height / 2.0];
- // 使用setValue:forKey:方法设置滤镜属性
- [grad setValue:center forKey:@"inputCenter"];
- // 在指定滤镜名时提供所有滤镜键值对
- CIFilter* dark = [CIFilter filterWithName:@"CIDarkenBlendMode" keysAndValues:@"inputImage", grad.outputImage, @"inputBackgroundImage", moi2, nil];
- CIContext* c = [CIContext contextWithOptions:nil];
- CGImageRef moi3 = [c createCGImage:dark.outputImage fromRect:moi2.extent];
- UIImage* moi4 = [UIImage imageWithCGImage:moi3 scale:moi.scale orientation:moi.imageOrientation];
- CGImageRelease(moi3);
- - (void)drawRect:(CGRect)rect {
- CGContextRef ctx = UIGraphicsGetCurrentContext();
- CGContextSaveGState(ctx);
- {
- // 绘图代码
- }
- CGContextRestoreGState(ctx);
- }
- CGContextRef con = UIGraphicsGetCurrentContext();
- CGContextSetFillColorWithColor(con, [UIColor blueColor].CGColor);
- CGContextFillRect(con, rect);
- CGContextClearRect(con, CGRectMake(0,0,30,30));
- CGContextRef con = UIGraphicsGetCurrentContext();
- // 绘制一个黑色的垂直黑色线,作为箭头的杆子
- CGContextMoveToPoint(con, 100, 100);
- CGContextAddLineToPoint(con, 100, 19);
- CGContextSetLineWidth(con, 20);
- CGContextStrokePath(con);
- // 绘制一个红色三角形箭头
- CGContextSetFillColorWithColor(con, [[UIColor redColor] CGColor]);
- CGContextMoveToPoint(con, 80, 25);
- CGContextAddLineToPoint(con, 100, 0);
- CGContextAddLineToPoint(con, 120, 25);
- CGContextFillPath(con);
- // 从箭头杆子上裁掉一个三角形,使用清除混合模式
- CGContextMoveToPoint(con, 90, 101);
- CGContextAddLineToPoint(con, 100, 90);
- CGContextAddLineToPoint(con, 110, 101);
- CGContextSetBlendMode(con, kCGBlendModeClear);
- CGContextFillPath(con);
- UIBezierPath* p = [UIBezierPath bezierPath];
- [p moveToPoint:CGPointMake(100,100)];
- [p addLineToPoint:CGPointMake(100, 19)];
- [p setLineWidth:20];
- [p stroke];
- [[UIColor redColor] set];
- [p removeAllPoints];
- [p moveToPoint:CGPointMake(80,25)];
- [p addLineToPoint:CGPointMake(100, 0)];
- [p addLineToPoint:CGPointMake(120, 25)];
- [p fill];
- [p removeAllPoints];
- [p moveToPoint:CGPointMake(90,101)];
- [p addLineToPoint:CGPointMake(100, 90)];
- [p addLineToPoint:CGPointMake(110, 101)];
- [p fillWithBlendMode:kCGBlendModeClear alpha:1.0];
- - (void)drawRect:(CGRect)rect {
- CGContextRef ctx = UIGraphicsGetCurrentContext();
- CGContextSetStrokeColorWithColor(ctx, [UIColor blackColor].CGColor);
- CGContextSetLineWidth(ctx, 3);
- UIBezierPath *path;
- path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(100, 100, 100, 100) byRoundingCorners:(UIRectCornerTopLeft |UIRectCornerTopRight) cornerRadii:CGSizeMake(10, 10)];
- [path stroke];
- }
- CGContextRef con = UIGraphicsGetCurrentContext();
- // 在上下文裁剪区域中挖一个三角形状的孔
- CGContextMoveToPoint(con, 90, 100);
- CGContextAddLineToPoint(con, 100, 90);
- CGContextAddLineToPoint(con, 110, 100);
- CGContextClosePath(con);
- CGContextAddRect(con, CGContextGetClipBoundingBox(con));
- // 使用奇偶规则,裁剪区域为矩形减去三角形区域
- CGContextEOClip(con);
- // 绘制垂线
- CGContextMoveToPoint(con, 100, 100);
- CGContextAddLineToPoint(con, 100, 19);
- CGContextSetLineWidth(con, 20);
- CGContextStrokePath(con);
- // 画红色箭头
- CGContextSetFillColorWithColor(con, [[UIColor redColor] CGColor]);
- CGContextMoveToPoint(con, 80, 25);
- CGContextAddLineToPoint(con, 100, 0);
- CGContextAddLineToPoint(con, 120, 25);
- CGContextFillPath(con);
- CGContextRef con = UIGraphicsGetCurrentContext();
- CGContextSaveGState(con);
- // 在上下文裁剪区域挖一个三角形孔
- CGContextMoveToPoint(con, 90, 100);
- CGContextAddLineToPoint(con, 100, 90);
- CGContextAddLineToPoint(con, 110, 100);
- CGContextClosePath(con);
- CGContextAddRect(con, CGContextGetClipBoundingBox(con));
- CGContextEOClip(con);
- //绘制一个垂线,让它的轮廓形状成为裁剪区域
- CGContextMoveToPoint(con, 100, 100);
- CGContextAddLineToPoint(con, 100, 19);
- CGContextSetLineWidth(con, 20);
- // 使用路径的描边版本替换图形上下文的路径
- CGContextReplacePathWithStrokedPath(con);
- // 对路径的描边版本实施裁剪
- CGContextClip(con);
- // 绘制渐变
- CGFloat locs[3] = { 0.0, 0.5, 1.0 };
- CGFloat colors[12] = {
- 0.3,0.3,0.3,0.8, // 开始颜色,透明灰
- 0.0,0.0,0.0,1.0, // 中间颜色,黑色
- 0.3,0.3,0.3,0.8 // 末尾颜色,透明灰
- };
- CGColorSpaceRef sp = CGColorSpaceCreateDeviceGray();
- CGGradientRef grad = CGGradientCreateWithColorComponents (sp, colors, locs, 3);
- CGContextDrawLinearGradient(con, grad, CGPointMake(89,0), CGPointMake(111,0), 0);
- CGColorSpaceRelease(sp);
- CGGradientRelease(grad);
- CGContextRestoreGState(con); // 完成裁剪
- // 绘制红色箭头
- CGContextSetFillColorWithColor(con, [[UIColor redColor] CGColor]);
- CGContextMoveToPoint(con, 80, 25);
- CGContextAddLineToPoint(con, 100, 0);
- CGContextAddLineToPoint(con, 120, 25);
- CGContextFillPath(con);
- CGColorSpaceRef sp2 = CGColorSpaceCreatePattern(NULL);
- CGContextSetFillColorSpace (con, sp2);
- CGColorSpaceRelease (sp2);
- CGPatternCallbacks callback = {0, &drawStripes, NULL };
- CGAffineTransform tr = CGAffineTransformIdentity;
- CGPatternRef patt = CGPatternCreate(NULL,CGRectMake(0,0,4,4), tr, 4, 4, kCGPatternTilingConstantSpacingMinimalDistortion, true, &callback);
- CGFloat alph = 1.0;
- CGContextSetFillPattern(con, patt, &alph);
- CGPatternRelease(patt);
- void drawStripes (void *info, CGContextRef con) {
- // assume 4 x 4 cell
- CGContextSetFillColorWithColor(con, [[UIColor redColor] CGColor]);
- CGContextFillRect(con, CGRectMake(0,0,4,4));
- CGContextSetFillColorWithColor(con, [[UIColor blueColor] CGColor]);
- CGContextFillRect(con, CGRectMake(0,0,4,2));
- }
- - (void)drawRect:(CGRect)rect {
- UIGraphicsBeginImageContextWithOptions(CGSizeMake(40,100), NO, 0.0);
- CGContextRef con = UIGraphicsGetCurrentContext();
- CGContextSaveGState(con);
- CGContextMoveToPoint(con, 90 - 80, 100);
- CGContextAddLineToPoint(con, 100 - 80, 90);
- CGContextAddLineToPoint(con, 110 - 80, 100);
- CGContextMoveToPoint(con, 110 - 80, 100);
- CGContextAddLineToPoint(con, 100 - 80, 90);
- CGContextAddLineToPoint(con, 90 - 80, 100);
- CGContextClosePath(con);
- CGContextAddRect(con, CGContextGetClipBoundingBox(con));
- CGContextEOClip(con);
- CGContextMoveToPoint(con, 100 - 80, 100);
- CGContextAddLineToPoint(con, 100 - 80, 19);
- CGContextSetLineWidth(con, 20);
- CGContextReplacePathWithStrokedPath(con);
- CGContextClip(con);
- CGFloat locs[3] = { 0.0, 0.5, 1.0 };
- CGFloat colors[12] = {
- 0.3,0.3,0.3,0.8,
- 0.0,0.0,0.0,1.0,
- 0.3,0.3,0.3,0.8
- };
- CGColorSpaceRef sp = CGColorSpaceCreateDeviceGray();
- CGGradientRef grad = CGGradientCreateWithColorComponents (sp, colors, locs, 3);
- CGContextDrawLinearGradient (con, grad, CGPointMake(89 - 80,0), CGPointMake(111 - 80,0), 0);
- CGColorSpaceRelease(sp);
- CGGradientRelease(grad);
- CGContextRestoreGState(con);
- CGColorSpaceRef sp2 = CGColorSpaceCreatePattern(NULL);
- CGContextSetFillColorSpace (con, sp2);
- CGColorSpaceRelease (sp2);
- CGPatternCallbacks callback = {0, &drawStripes, NULL };
- CGAffineTransform tr = CGAffineTransformIdentity;
- CGPatternRef patt = CGPatternCreate(NULL,CGRectMake(0,0,4,4),tr,4,4,kCGPatternTilingConstantSpacingMinimalDistortion,true, &callback);
- CGFloat alph = 1.0;
- CGContextSetFillPattern(con, patt, &alph);
- CGPatternRelease(patt);
- CGContextMoveToPoint(con, 80 - 80, 25);
- CGContextAddLineToPoint(con, 100 - 80, 0);
- CGContextAddLineToPoint(con, 120 - 80, 25);
- CGContextFillPath(con);
- UIImage* im = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- con = UIGraphicsGetCurrentContext();
- [im drawAtPoint:CGPointMake(0,0)];
- for (int i=0; i<3; i++) {
- CGContextTranslateCTM(con, 20, 100);
- CGContextRotateCTM(con, 30 * M_PI/180.0);
- CGContextTranslateCTM(con, -20, -100);
- [im drawAtPoint:CGPointMake(0,0)];
- }
- }
- CGContextTranslateCTM(con, 0, theHeight);
- CGContextScaleCTM(con, 1.0, -1.0);
- CGContextTranslateCTM(con, 0, sz.height); // sz为[mars size]
- CGContextScaleCTM(con, 1.0, -1.0);
- CGContextDrawImage(con, CGRectMake(0, 0, sz.width/2.0, sz.height), marsLeft);
- CGContextDrawImage(con, CGRectMake(b.size.width-sz.width/2.0, 0, sz.width/2.0, sz.height),marsRight);
- con = UIGraphicsGetCurrentContext();
- CGContextSetShadow(con, CGSizeMake(7, 7), 12);
- [im drawAtPoint:CGPointMake(0,0)];
- con = UIGraphicsGetCurrentContext();
- CGContextSetShadow(con, CGSizeMake(7, 7), 12);
- CGContextBeginTransparencyLayer(con, NULL);
- [im drawAtPoint:CGPointMake(0,0)];
- for (int i=0; i<3; i++) {
- CGContextTranslateCTM(con, 20, 100);
- CGContextRotateCTM(con, 30 * M_PI/180.0);
- CGContextTranslateCTM(con, -20, -100);
- [im drawAtPoint:CGPointMake(0,0)];
- }
- // 在调用了CGContextEndTransparencyLayer函数之后,
- // 图层内容会在应用全局alpha和上下文阴影状态之后被合成到上下文中
- CGContextEndTransparencyLayer(con);
- CGContextFillRect(con, CGRectMake(100,0,1.0/self.contentScaleFactor,100));
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- self.window.rootViewController = [UIViewController new];
- MyView* mv =[[MyView alloc] initWithFrame:CGRectMake(0, 0, self.window.bounds.size.width - 50, 150)];
- mv.center = self.window.center;
- [self.window.rootViewController.view addSubview: mv];
- mv.opaque = NO;
- mv.tag = 111; // so I can get a reference to this view later
- [self performSelector:@selector(resize:) withObject:nil afterDelay:0.1];
- self.window.backgroundColor = [UIColor whiteColor];
- [self.window makeKeyAndVisible];
- return YES;
- }
iOS绘图教程的更多相关文章
- iOS绘图教程 (转,拷贝以记录)
本文是<Programming iOS5>中Drawing一章的翻译,考虑到主题完整性,在翻译过程中我加入了一些书中没有涉及到的内容.希望本文能够对你有所帮助. 转自:http://www ...
- IOS 绘图教程Quartz2D
http://www.cocoachina.com/industry/20140115/7703.html http://www.cnblogs.com/wendingding/p/3803020.h ...
- iOS绘图框架CoreGraphics分析
由于CoreGraphics框架有太多的API,对于初次接触或者对该框架不是十分了解的人,在绘图时,对API的选择会感到有些迷茫,甚至会觉得iOS的图形绘制有些繁琐.因此,本文主要介绍一下iOS的绘图 ...
- iOS开发--绘图教程
本文是<Programming iOS5>中Drawing一章的翻译,考虑到主题完整性,翻译版本中加入了一些书中未涉及到的内容.希望本文能够对你有所帮助. 本文由海水的味道翻译整理,转载请 ...
- [[iso教程]] 《4个月ios实体教程》全网最新、最全ios视频教程
全网最新.最全ios视频教程 内容简介 <ios实体教程>主要介绍如何使用iOS提供的强大工具集创建iOS应用.全视频对iOS操作系统做了全面的介绍,首先讲解如何构建应用程序的用户界面,涵 ...
- fir.im Weekly - 给女朋友的 iOS 开发教程
俗话说:技多不压身,功到自然成.本期 fir.im Weekly 收集的热度资源,大部分关于Android.iOS 开发工具和源码,还有一些有关设计的 Tips ,希望对你有帮助. 给女朋友的 iOS ...
- 论文第4章:iOS绘图平台的实现
面向移动设备的矢量绘图平台设计与实现 Design and Implementation of Mobile Device-oriented Vector Drawing Platform 引用本论文 ...
- IOS绘图
#import "ViewController.h" #import "DrawView.h" @interface ViewController () @pr ...
- IOS 学习教程
IOS 学习教程http://www.gaixue.com/course/236#### 讲课http://wenku.baidu.com/view/6786064fe518964bcf847c63. ...
随机推荐
- 远程连接到Fedora
首先执行以下3点(主要是前两点) 第一: 开启ssh #service sshd restart 第二:关闭防火墙 #service iptables stop 第三:selinux(重启电脑后失效) ...
- keepalived vip漂移基本原理及选举算法
keepalived可以将多个无状态的单点通过虚拟IP(以下称为VIP)漂移的方式搭建成一个高可用服务,常用组合比如 keepalived+nginx,lvs,haproxy和memcached等.它 ...
- MySql Update Select 嵌套
UPDATE `TB_CM_Dic` SET `ParentID` = (SELECT `ID` FROM (SELECT * FROM `TB_CM_Dic`) AS B WHERE `DicNam ...
- linux syslog详解
linux syslog详解 分三部分 一.syslog协议介绍 二.syslog函数 三.linux syslog配置 一.syslog协议介绍 1.介绍 在Unix类操作系统上,syslog广 ...
- UIButton和UIImageView的区别
1.显示图片 1> UIImageView只能一种图片(图片默认会填充整个UIImageView) image\setImage: 2> UIButton能显示2种图片 * 背景 (背景 ...
- C#设置textboox只能输入数字`
1.在闪电KeyPress事件中添加 private void textBox_pwmx_fre_KeyPress(object sender, KeyPressEventArgs e) { //如果 ...
- 《APUE》读书笔记第十一章-线程
本章主要介绍了线程,了解如何使用多线程在单进程环境中来执行多任务.由于多个线程共享其进程空间,所以必须采用同步的机制来保护数据的一致性. 一.线程的概念 典型的Unix系统都可以看成只有一个控制线程, ...
- LUA 捕获模式 URL编码的例子解析
function escape(s) s=string.gsub(s,"([&=+%c])",function(c) return string.format(" ...
- Manasa and Stones
from __future__ import print_function def main(): t = int(raw_input()) for _ in range(t): n = int(ra ...
- c# 高效分页只需一个dll实例
第一.首先下载WebUIControl.dll http://pan.baidu.com/s/1gdkilDh 第二.添加引用 三.应用实例-前台代码 <%@ Register Assembly ...