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. ...
随机推荐
- 从点亮一个LED开始,Cortex-A9裸机程序设计
电路原理图: 如何点亮一个LED? 通过对原理图进行分析,我们能够发现给三极管的基极加上一个高点平时,三级管be结导通构成通路,此时二极管就点亮了.若要将LED熄灭只需取消高电平输出. 如何使三级管基 ...
- linux 终止用户会话
第一步使用 tty 命令 查看自己会话id:本例中会话id为1[root@localhost ~]# tty/dev/pts/1[root@localhost ~]# 第二步 使用 w 命令 查看当前 ...
- (转)添加服务引用和添加Web引用对比
在WindowsForm程序中添加服务引用和Web引用对比 为了验证书上有关Visual Studio 2010添加服务引用和Web引用的区别,进行实验. 一.建立一个Web服务程序项目新建项目,选择 ...
- OC基础 点语法的使用
OC基础 点语法的使用 1.创建一个Student类继承于NSObject,Student.h文件 #import <Foundation/Foundation.h> @interface ...
- arry()数组的理解及api的使用(一)
我们想要了解数组,首先就要先要了解到什么是数据结构,所谓的数据结构就是把数据与数据见的关系按照特定的结构来保存.设计合理的数据结构是解决问题的前提.了解了数据结构后我们下面来数组的定义:数组(arra ...
- 7 Hbase put方式插入数据
package com.hikvision.hbase.vertify.test; import org.apache.hadoop.conf.Configuration; import org.ap ...
- 基于nginx的HLS简单服务器搭建
一,首先搭建nginx服务器: 1.1,选定源码目录 选定目录 /usr/local/HLS cd /usr/local/HLS 1.2,安装PCRE库 cd /usr/local/HLS 到www. ...
- CString 字符串转化和分割
1.格式化字符串 CString s;s.Format(_T("The num is %d."), i);相当于sprintf() 2.转为 int 转10进制最好用_ttoi() ...
- Hadoop文件的基本操作
Hadoop提供了大量的API对文件系统中的文件进行操作,主要包括: (1)读取文件 (2)写文件 (3)读取文件属性 (4)列出文件 (5)删除文件 1、读取文件 以下示例中,将hdfs中的一个文件 ...
- 在js中使用json
在js中使用json var obj = { "1" : "value1", "2" : "value2" ...