Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 我可以合并2个图像吗?_Objective C_Ios5 - Fatal编程技术网

Objective c 我可以合并2个图像吗?

Objective c 我可以合并2个图像吗?,objective-c,ios5,Objective C,Ios5,我很难修改我的代码。如何在不使用addSubview方法的情况下添加和组合2个UIImage?是否有任何可能的解决方案来组合2个UIImages?这是我的代码 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { if (CGRectIntersectsRect(piece1.frame, piece2.frame)) { if (piece1.center.x < piec

我很难修改我的代码。如何在不使用
addSubview
方法的情况下添加和组合2个UIImage?是否有任何可能的解决方案来组合2个UIImages?这是我的代码

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{ 
    if (CGRectIntersectsRect(piece1.frame, piece2.frame))
    { 
        if (piece1.center.x < piece2.center.x) 
        { 
            NSLog(@"ok"); 
        }
    } 
}
-(void)touchesend:(NSSet*)toucheevent:(UIEvent*)event
{ 
if(CGRectIntersectsRect(片段1.frame,片段2.frame))
{ 
如果(工件1.center.x<工件2.center.x)
{ 
NSLog(@“正常”);
}
} 
}

类似于此。(我还没有检查密码,当心)。而且有多种blendMode可用

CGRect drawRect = CGRectMake(0, 0, imageWidth, imageHeight);

UIGraphicsBeginImageContext(CGSizeMake(imageWidth, imageHeight));

[piece1 drawInRect: drawRect blendMode:kCGBlendModeNormal alpha:1];
[piece2 drawInRect: drawRect blendMode:kCGBlendModeScreen alpha:1];
UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();  

UIGraphicsEndImageContext();

在这里搜索-有很多问题和答案。>如果我想合并2个uiimages,我会在这里添加什么?-(void)touchesedend:(NSSet*)toucheevent:(UIEvent*)event{if(CGRectIntersectsRect(piece1.frame,piece2.frame)){if(piece1.center.xUIGraphicsBeginImageContext()是您的朋友,假设您正试图将两个
UIImage
组合成一个新的。@DaDODU:您需要做一些研究。@DaDODU不要在注释中发布代码。相反,编辑你原来的帖子。