我的代码:如何管理不同色调的脸部的RGB值,以及如何应用?这段代码会改变脸部的颜色和头发,但我想1.只是面部除了头发的颜色.
-(void)changeSkinColorValue:(float)value WithImage:(UIImage*)needToModified
{
CGContextRef ctx;
CGImageRef imageRef = needToModified.CGImage;
NSUInteger width = CGImageGetWidth(imageRef);
NSUInteger height = CGImageGetHeight(imageRef);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
//unsigned char *rawData = malloc(firstImageV.image.size.height * firstImageV.image.size.width * 10);
CFMutableDataRef m_DataRef = CFDataCreateMutableCopy(0, 0,CGDataProviderCopyData(CGImageGetDataProvider(firstImageV.image.CGImage)));
UInt8 *rawData = (UInt8 *) CFDataGetMutableBytePtr(m_DataRef);
int length = CFDataGetLength(m_DataRef);
NSUInteger bytesPerPixel = 4;
NSUInteger bytesPerRow = bytesPerPixel * firstImageV.image.size.width;
NSUInteger bitsPerComponent = 8;
CGContextRef context1 = CGBitmapContextCreate(rawData, firstImageV.image.size.width, firstImageV.image.size.height, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
CGColorSpaceRelease(colorSpace);
CGContextDrawImage(context1, CGRectMake(0, 0, firstImageV.image.size.width, firstImageV.image.size.height), imageRef);
NSLog(@"%d::%d",width,height); …Run Code Online (Sandbox Code Playgroud) 我正在开发一个与HairTryOn相同的应用程序.但问题在下图中显示.我想根据客户脸部设置发型,使用蓝线按照图像显示.我使用以下代码
testVw = [[UIView alloc]initWithFrame:CGRectMake(100,100, 100, 100)];
testVw.backgroundColor = [UIColor clearColor];
[self.view addSubview:testVw];
resizeVw = [[UIImageView alloc]initWithFrame:CGRectMake(testVw.frame.size.width-25, testVw.frame.size.height-25, 25, 25)];
resizeVw.backgroundColor = [UIColor clearColor];
resizeVw.userInteractionEnabled = YES;
resizeVw.image = [UIImage imageNamed:@"button_02.png" ];
[testVw addSubview:resizeVw];
UIPanGestureRecognizer* panResizeGesture = [[UIPanGestureRecognizer alloc]
initWithTarget:self action:@selector(resizeTranslate:)];
[testVw addGestureRecognizer:panResizeGesture];
Run Code Online (Sandbox Code Playgroud)
该resizeTranslate:方法:
-(void)resizeTranslate:(UIPanGestureRecognizer *)recognizer
{
if ([recognizer state]== UIGestureRecognizerStateBegan)
{
prevPoint = [recognizer locationInView:testVw.superview];
[testVw setNeedsDisplay];
}
else if ([recognizer state] == UIGestureRecognizerStateChanged)
{
if (testVw.bounds.size.width < 20)
{
testVw.bounds = CGRectMake(testVw.bounds.origin.x, testVw.bounds.origin.y, 20,testVw.bounds.size.height);
imgvw.frame = …Run Code Online (Sandbox Code Playgroud) 我想在iOS中创建标签,任何人都可以帮助我使标签文本的第一个单词加粗和可点击.标签显示用户名及其注释,第一个单词始终是用户名.提前致谢!
我正在开发一个裁缝的应用程序,我想测量它的布料的人体大小.看到图片

在所有测量后它显示结果如...

这可能吗?我搜索Google Width and Height of Human Body以及其他SO.如果这种类型的应用程序的任何示例真的很感激.
嗨我正在开发一个应用程序.在那个我做了一个视图的动画从左到右和从右到左移动并更改该视图中包含的标签的值.但是当我点击向左或向右按钮时该视图被删除新视图覆盖旧视图.所以我不想覆盖.我想添加新视图.我的代码是
-(void)centerAnimation1:(id)sender
{
UIView *currentView = daysview;
theWindow = daysview;
// set up an animation for the transition between the views
CATransition *animation = [CATransition animation];
animation.delegate = self;
[animation setDuration:0.4];
[animation setType:kCATransitionMoveIn];
if(rhtolft)
{
[animation setSubtype:kCATransitionFromLeft];
}
else
{
[animation setSubtype:kCATransitionFromRight];
}
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"];
[currentView removeFromSuperview];
}
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{
if(animate)
{
CATransition *animation = [CATransition animation];
animation.delegate = self;
[animation setDuration:0.4];
[animation setType:kCATransitionMoveIn];
if(rhtolft)
{
[animation setSubtype:kCATransitionFromLeft];
rhtolft=NO;
}
else
{
[animation …Run Code Online (Sandbox Code Playgroud) 我正在使用视频过滤.我使用了BradLarson的
GPUImage.它完美的图像工作,但现在我试图从库过滤视频文件,它给我错误[AVAssetWriter startWriting] Cannot call method when status is 3.我用过IOS7
heare是我的代码
- (void)viewDidLoad
{
[super viewDidLoad];
videoEditingPlayView = [[GPUImageView alloc] initWithFrame:CGRectMake(60,108,200,200)];
[self.view addSubview:videoEditingPlayView];
}
-(IBAction)btnEffectsClick:(id)sender{
NSURL *videoURl = [NSURL fileURLWithPath:self.strVideoURl];
if (movieFile != nil) {
videoFilter = nil;
movieFile = nil;
}
movieFile = [[GPUImageMovie alloc] initWithURL:videoURl];
movieFile.runBenchmark = YES;
videoFilter = [[GPUImageBrightnessFilter alloc] init];
[(GPUImageBrightnessFilter *)videoFilter setBrightness:0.0];
[movieFile addTarget:videoFilter];
videoEditingPlayView.hidden = NO;
GPUImageView *filterView = (GPUImageView *)videoEditingPlayView;
[videoFilter addTarget:filterView];
NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.m4v"];
NSURL *movieURL …Run Code Online (Sandbox Code Playgroud) 我在课堂上有7种方法.当我收到一条特定的消息时,我必须从这7种方法中随机调用一种方法.我的示例代码是:
-(void)poemAbcd{
UIImage *image = [UIImage imageNamed: @"abcd_bg.png"];
[backgroundImage setImage:image];
[self changeMumuPosition:80 with:220];
}
-(void)poemHumptyDumpty{
UIImage *image = [UIImage imageNamed: @"humpty_dumpty.png"];
[backgroundImage setImage:image];
[self changeMumuPosition:80 with:170];
}
-(void)poemBlackship{
UIImage *image = [UIImage imageNamed: @"black_sheep.png"];
[backgroundImage setImage:image];
[self changeMumuPosition:66 with:229];
}
-(void)poemRowRow{
UIImage *image = [UIImage imageNamed: @"boat_bg.png"];
[backgroundImage setImage:image];
[self changeMumuPosition:144 with:211];
}
-(void)poemHappy{
UIImage *image = [UIImage imageNamed: @"boat_bg.png"];
[backgroundImage setImage:image];
[self changeMumuPosition:144 with:211];
}
-(void)poemItsyBitsy{
UIImage *image = [UIImage imageNamed: @"boat_bg.png"];
[backgroundImage setImage:image];
[self changeMumuPosition:144 with:211];
}
-(void)poemTwinkleTwinkle{ …Run Code Online (Sandbox Code Playgroud) 我想搜索 NSMutalbleArray,我的代码是:
arrCelebs=[[NSMutableArray alloc] initWithObjects:@"Test 1",@"Test 2",@"Test 42",@"Test 5", nil];
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
NSString *arrString1 = txtSearch.text;
NSRange tmprange;
for(NSString *string in arrCelebs) {
tmprange = [arrString1 rangeOfString:string];
if (tmprange.location != NSNotFound) {
NSLog(@"String found");
break;
}
}
return YES;
}
Run Code Online (Sandbox Code Playgroud)
如果我输入"t"然后它搜索所有数据,我想添加另一个数组.用于在tableview中显示.
我需要根据单词拆分字符串.该单词可以是任何Case,我需要保留子字符串数组的大小写.例:
ios ×9
iphone ×8
objective-c ×4
ipad ×2
uiimageview ×2
bezier ×1
gpuimage ×1
uibezierpath ×1
uilabel ×1
xcode ×1
xcode4.2 ×1