当前位置: 编程技术>移动开发
本页文章导读:
▪Thead 1:proogram received signal:"SIGABRT" 异常 Thead 1:proogram received signal:"SIGABRT" 错误
之前好好的程序 出现以下错误:Thead 1:proogram received signal:"SIGABRT"打开debug模式,找到出现在:managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] .........
▪ 绘图小结 绘图总结
1.绘图总结:绘图前设置:CGContextSetRGBFillColor/CGContextSetFillColorWithColor //填充色CGContextSetRGBStrokeColor/CGContextSetStrokeColorWithColor //笔颜色CGContextSetLineWidth .........
▪ 资料下传 资料上传
我的资料
......
[1]Thead 1:proogram received signal:"SIGABRT" 异常
来源: 互联网 发布时间: 2014-02-18
Thead 1:proogram received signal:"SIGABRT" 错误
之前好好的程序 出现以下错误:
Thead 1:proogram received signal:"SIGABRT"
打开debug模式,找到出现在:
managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] retain];
consel 输出的错误 :
Can’t merge models with two different entities named “bookmark”
解决如下:
修改了Core Data的数据模型后(其实本人没有改变数据模型,可能步小心碰到吧),因为版本问题出现的Exception 解决办法
在mac上删除device 上文件夹 ,再重新连接device ,按clean 后重新build 就可以了
之前好好的程序 出现以下错误:
Thead 1:proogram received signal:"SIGABRT"
打开debug模式,找到出现在:
managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] retain];
consel 输出的错误 :
Can’t merge models with two different entities named “bookmark”
解决如下:
修改了Core Data的数据模型后(其实本人没有改变数据模型,可能步小心碰到吧),因为版本问题出现的Exception 解决办法
在mac上删除device 上文件夹 ,再重新连接device ,按clean 后重新build 就可以了
[2] 绘图小结
来源: 互联网 发布时间: 2014-02-18
绘图总结
1.绘图总结:
绘图前设置:
CGContextSetRGBFillColor/CGContextSetFillColorWithColor //填充色
CGContextSetRGBStrokeColor/CGContextSetStrokeColorWithColor //笔颜色
CGContextSetLineWidth //线宽度
绘图后设置:
注: 画完图后,必须
先用CGContextStrokePath来描线,即形状
后用CGContextFillPath来填充形状内的颜色.
2.常见图形绘制:
CGContextFillRect/CGContextFillRects
CGContextFillEllipseInRect
CGContextAddRect/CGContextAddRects
CGContextAddEllipseInRect
CGContextAddLines
CGContextMoveToPoint
CGContextAddLineToPoint
3.常见控制方法:
CGContextSaveGState
CGContextRestoreGState
4.创建内存图像context:
CGBitmapContextCreate <-----CGContextRlease释放
CGColorSpaceCreateWithName (KCGColorSpaceGenericRGB)
CGColorSpaceRlease
CGBitmapContextCreateImage() <-----CGImageRlease 释放.
eg:
CGContextRefMyCreateBitmapContext(intpixelsWide,intpixelsHigh)
{
CGContextRef context=NULL;
CGColorSpaceRefcolorSpace;
void* bitmapData;
int bitmapByteCount;
int bitmapBytesPerRow;
bitmapBytesPerRow =(pixelsWide*4);
bitmapByteCount =(bitmapBytesPerRow*pixelsHigh);
colorSpace=CGColorSpaceCreateDeviceRGB();
bitmapData=malloc(bitmapByteCount);
if(bitmapData==NULL)
{
fprintf(stderr,"Memorynotallocated!");
returnNULL;
}
context=CGBitmapContextCreate(bitmapData, pixelsWide, pixelsHigh, 8, bitmapBytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast);
if(context==NULL)
{
free(bitmapData);
fprintf(stderr,"Contextnotcreated!");
returnNULL;
}
CGColorSpaceRelease(colorSpace);
returncontext;
}
5.图形的变换:
CGContextTranslateCTM
CGContextRotateCTM
CGContextScaleCTM
6.常用函数:
CGRectContainsPoint();
CGRectContainsRect();
CGRectIntersectsRect();
CGRectIntersection();
CGPointEqualToPoint();
CGSizeEqualToSize();
7.从原图片中取小图.
CGImageCreateWithImageInRect
8.屏幕快照:
#import "QuartzCore/QuartzCore.h"
UIGraphicsBeginImageContext(yourView.frame.size);
[[yourView layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage*screenshot =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
from:http://www.cppblog.com/zhangyuntaoshe/articles/123066.html
合并两张bit图到一张image的方法
To graphically merge two images into a new image, you do something like this:
UIImage *result = nil;
unsignedchar *data = calloc(1,size.width*size.height*kBytesPerPixel);
if (data != NULL) {
// kCGImageAlphaPremultipliedLast 为预记录的#define value
// 设置context上下文
CGContextRef context = CGBitmapContextCreate(
data, size.width, size.height, 8, size.width*kBytesPerPixel,
CGColorSpaceCreateDeviceRGB(), kCGImageAlphaPremultipliedLast);
if (context != NULL) {
UIGraphicsPushContext(context);
// Image 为下载的背景图片,用于比较context
CGContextTranslateCTM(context, 0, size.height);
CGContextScaleCTM(context, 1, -1);
[image drawInRect:imageRect];
[image2 drawInRect:image2Rect];
UIGraphicsPopContext();
CGImageRef imageRef = CGBitmapContextCreateImage(context);
if (imageRef != NULL) {
result = [UIImageimageWithCGImage:imageRef];
CGImageRelease(imageRef);
}
CGContextRelease(context);
}
free(data);
}
return result;
关键方法: CGContextRef context = CGBitmapContextCreate();
CGContextTranslateCTM();
CGContextScaleCTM();
CGImageRef imageRef = CGBitmapContextCreateImage(context);
CGImageRelease(imageRef);
1.绘图总结:
绘图前设置:
CGContextSetRGBFillColor/CGContextSetFillColorWithColor //填充色
CGContextSetRGBStrokeColor/CGContextSetStrokeColorWithColor //笔颜色
CGContextSetLineWidth //线宽度
绘图后设置:
注: 画完图后,必须
先用CGContextStrokePath来描线,即形状
后用CGContextFillPath来填充形状内的颜色.
2.常见图形绘制:
CGContextFillRect/CGContextFillRects
CGContextFillEllipseInRect
CGContextAddRect/CGContextAddRects
CGContextAddEllipseInRect
CGContextAddLines
CGContextMoveToPoint
CGContextAddLineToPoint
3.常见控制方法:
CGContextSaveGState
CGContextRestoreGState
4.创建内存图像context:
CGBitmapContextCreate <-----CGContextRlease释放
CGColorSpaceCreateWithName (KCGColorSpaceGenericRGB)
CGColorSpaceRlease
CGBitmapContextCreateImage() <-----CGImageRlease 释放.
eg:
CGContextRefMyCreateBitmapContext(intpixelsWide,intpixelsHigh)
{
CGContextRef context=NULL;
CGColorSpaceRefcolorSpace;
void* bitmapData;
int bitmapByteCount;
int bitmapBytesPerRow;
bitmapBytesPerRow =(pixelsWide*4);
bitmapByteCount =(bitmapBytesPerRow*pixelsHigh);
colorSpace=CGColorSpaceCreateDeviceRGB();
bitmapData=malloc(bitmapByteCount);
if(bitmapData==NULL)
{
fprintf(stderr,"Memorynotallocated!");
returnNULL;
}
context=CGBitmapContextCreate(bitmapData, pixelsWide, pixelsHigh, 8, bitmapBytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast);
if(context==NULL)
{
free(bitmapData);
fprintf(stderr,"Contextnotcreated!");
returnNULL;
}
CGColorSpaceRelease(colorSpace);
returncontext;
}
5.图形的变换:
CGContextTranslateCTM
CGContextRotateCTM
CGContextScaleCTM
6.常用函数:
CGRectContainsPoint();
CGRectContainsRect();
CGRectIntersectsRect();
CGRectIntersection();
CGPointEqualToPoint();
CGSizeEqualToSize();
7.从原图片中取小图.
CGImageCreateWithImageInRect
8.屏幕快照:
#import "QuartzCore/QuartzCore.h"
UIGraphicsBeginImageContext(yourView.frame.size);
[[yourView layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage*screenshot =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
from:http://www.cppblog.com/zhangyuntaoshe/articles/123066.html
合并两张bit图到一张image的方法
To graphically merge two images into a new image, you do something like this:
UIImage *result = nil;
unsignedchar *data = calloc(1,size.width*size.height*kBytesPerPixel);
if (data != NULL) {
// kCGImageAlphaPremultipliedLast 为预记录的#define value
// 设置context上下文
CGContextRef context = CGBitmapContextCreate(
data, size.width, size.height, 8, size.width*kBytesPerPixel,
CGColorSpaceCreateDeviceRGB(), kCGImageAlphaPremultipliedLast);
if (context != NULL) {
UIGraphicsPushContext(context);
// Image 为下载的背景图片,用于比较context
CGContextTranslateCTM(context, 0, size.height);
CGContextScaleCTM(context, 1, -1);
[image drawInRect:imageRect];
[image2 drawInRect:image2Rect];
UIGraphicsPopContext();
CGImageRef imageRef = CGBitmapContextCreateImage(context);
if (imageRef != NULL) {
result = [UIImageimageWithCGImage:imageRef];
CGImageRelease(imageRef);
}
CGContextRelease(context);
}
free(data);
}
return result;
关键方法: CGContextRef context = CGBitmapContextCreate();
CGContextTranslateCTM();
CGContextScaleCTM();
CGImageRef imageRef = CGBitmapContextCreateImage(context);
CGImageRelease(imageRef);
[3] 资料下传
来源: 互联网 发布时间: 2014-02-18
资料上传
我的资料
最新技术文章: