Tag: uiimage

LeavesCache.m在模拟器上工作,但不在设备上

这是我第一次发表,所以请忍受我。 我一直在网站后search网站,我似乎无法find任何已经解决了这个问题。 如果有人能回答我会很高兴。 LeavesCache.m去年被修改,如果没有错误,以适应ios 7我认为。 代码在下面,但是我收到一个EXC_BAD_ACCESS return pageImage.CGImage 。 我改变它return (__bridge CGImageRef)(pageImage)但现在我的网页出来空白,即使它打印正确的页面索引。 请帮忙! CGImageRef)cachedImageForPageIndex:(NSUInteger)pageIndex { NSNumber *pageIndexNumber = [NSNumber numberWithInt:pageIndex]; UIImage *pageImage; @synchronized (self.pageCache) { pageImage = [self.pageCache objectForKey:pageIndexNumber]; } if (!pageImage) { CGImageRef pageCGImage = CGImageRetain([self imageForPageIndex:pageIndex]); if (pageCGImage) { pageImage = [UIImage imageWithCGImage:pageCGImage]; @synchronized (self.pageCache) { [self.pageCache setObject:pageImage forKey:pageIndexNumber]; } } } //modified […]

didFinishPickingMediaWithInfo方向问题

我试图在imagePickerController:didFinishPickingMediaWithInfopipe理图像旋转,但经过多次尝试,我没有find任何解决scheme。 我最后的尝试是: -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { // load the storyboard by name UIStoryboard *storyboard = [UIStoryboard storyboardWithName:[ApplicationSupport getStoryBoardName] bundle:nil]; UploadViewController *uploadView = [storyboard instantiateViewControllerWithIdentifier:@"ViewUploadFile"]; UIImage *image = [info valueForKey:UIImagePickerControllerOriginalImage]; NSDictionary *metadataImage = [info valueForKey:UIImagePickerControllerMediaMetadata]; uploadView.imageToUpload = image; if([[metadataImage objectForKey:@"Orientation"] intValue] == 3) { UIImage *imageRotated = [UIImage imageWithCGImage:[image CGImage] scale:[image scale] orientation:UIImageOrientationDown]; uploadView.dataToUpload = […]

在一个iOS中保存两个重叠的图像

可能的重复: 保存两个重叠UIImage 在UIScrollView中,我添加了我的UIImageView,并在其上面有一个框架层 。 我想在完成编辑后将最终的图像保存在屏幕上。 回答上面提到的问题做了这项工作,但是当它画框时,导致我的图像质量下降 ,所以我正在寻找一个解决scheme,使我的形象保持良好的分辨率。 请帮我解决这个问题,提前致谢!

UIImage返回零

我将创build一个UIImage但如果我debugging该方法返回nil 。 我希望有人知道我必须做什么。 我的代码: 返回nil: UIImage *image1 = imgView.image; 整个代码块: UIImage *image1 = imgView.image; NSString *cachedFolderPath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0]; NSString *cachedImagePath = [cachedFolderPath stringByAppendingPathComponent:@"image1.png"]; [UIImagePNGRepresentation(image1) writeToFile:cachedImagePath atomically:YES]; 更新: – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) { toolbar.hidden = NO; UIImage *image1 = imgView.image; NSString *cachedFolderPath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0]; NSString *cachedImagePath = […]

用核心graphics和图层蒙版裁剪UIImage

我一直在跟随这个问题来裁剪一个UIImageView与IBOutlet与图层蒙板连接,这里是问题和答案我下面如何在iOS中的UIImageView中圈内裁剪图像 。 但是现在我想知道如何在没有显示给用户的UIImageView的情况下完成这个工作。 (所以没有连接到IBOutlet)。 我评论了这篇文章,用户说,使用核心graphics裁剪图像没有连接。 我不知道如何做到这一点? 所以我想知道如何将裁剪应用到具有核心Core Graphics的UIImage或UIImageView? 我在这里先向您的帮助表示感谢。

如何用透明笔画保存图像

我跟着@Rob的答案和绘制,因为我想…但是当我保存这个图像….笔画不透明了 Objective-C如何避免在UIBezierPath的笔触颜色上绘制相同颜色的图像 为了保存图像我写了这个代码 -(void)saveImage { UIGraphicsBeginImageContextWithOptions(self.upperImageView.bounds.size, NO, 0); if ([self.upperImageView respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) [self.upperImageView drawViewHierarchyInRect:self.upperImageView.bounds afterScreenUpdates:YES]; // iOS7+ else [self.upperImageView.layer renderInContext:UIGraphicsGetCurrentContext()]; // pre iOS7 UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndPDFContext(); UIImageWriteToSavedPhotosAlbum(self.upperImageView.image, self,@selector(image:didFinishSavingWithError:contextInfo:), nil); }

UITableviewCell图像大小变化点击单元格?

我想以正常的方式显示UITableViewCell中的名称和图像 cell.textLabel.text=@"some name"; cell.imageView.image=[array objectAtIndex:indexPath.row]; 当我加载ViewController,我可以看到所有图像都正确,但当我试图点击任何UITableviewCell图像大小正在改变为大(请检查示例截图)。 请帮我解决这个问题。 加载时间看起来像 当我点击第一个单元格时,单元格图像变得像下面的图像一样大 请检查我的代码 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; cell.backgroundColor=[UIColor clearColor]; if(cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; } cell.backgroundColor=[UIColor clearColor]; if([userName count]>0){ cell.textLabel.text=[userName objectAtIndex:indexPath.row]; [cell.imageView setImageWithURL:[NSURL URLWithString:[[userList valueForKey:@"photo"] objectAtIndex:indexPath.row]] placeholderImage:[UIImage imageNamed:@"avatar.png"]]; } CGSize itemSize = CGSizeMake(40, 40); UIGraphicsBeginImageContextWithOptions(itemSize, […]

从tableView中的文件目录存储和检索图像?

我正试图从webservice存储在文件目录中的图像。对于存储的图像,我想从文档目录中加载它在表视图。 这些图像可以从一个URL访问,例如: http://Address/App/User/Image/Puegeot_E7 从webservice获取成功,但从文档目录我不断收到null image.Can似乎没有find这里有什么问题。 – (void)saveImage:(UIImage*)image withName:(NSString *)imageName { if (image != nil) { NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString* path = [documentsDirectory stringByAppendingPathComponent:imageName]; NSLog(@"Saving path %@",path); // Saving path /Users/computername/Library/Developer/CoreSimulator/Devices/7277F3D3-298C-451A-8607-8070A08650C7/data/Containers/Data/Application/D3AF4DD9-A4CD-42C8-A8EB-0F15C271EE61/Documents/CabImage/Puegeot_E7 NSData* data = UIImagePNGRepresentation(image); [data writeToFile:path atomically:YES]; } } – (UIImage *)getImageFromURL:(NSString *)fileURL { NSArray *paths […]

如何从另一个图像的一部分创build一个图像?

如何在iOS Swift中从另一个图像创build图像? 例如,如果我有1000像素(1000像素)的图像(A)。 我如何从图像(A)的中间创build200像素(200像素)的图像(B)。

在ios中从UIImage中删除行

我在UIImageView中有一个图像。 我已经成功地在图像上画线。现在我想要移除那个用户将执行长按手势的特定线。 我怎样才能做到这一点 ? 我的代码是: { // gets the location in the form of (x,y) coordinates CGPoint location=[sender locationInView:imageView]; // convetrs the location relative to the image CGPoint contextLocation = CGPointMake(location.x*imageView.image.size.width/imageView.frame.size.width, location.y*imageView.image.size.height/imageView.frame.size.height); // converts the location point into NSValue NSValue *imagePoint=[NSValue valueWithCGPoint:contextLocation]; // Adds the image into NSMutable Array [imageLocations addObject:imagePoint]; // color of line […]