Tag: uiimage

在iOS中的animation图像的最佳做法 – UIImage或UIImageView?

对不起,如果这个问题有点主观,但我找不到任何关于这个话题。 问题很简单: 以下哪一种select是“最好”的(即最佳性能)。 我想在UIImageView中显示图像,而不pipeselect的解决scheme。 self.imageView.image = [UIImage animatedImageNamed:@"imagename-" duration:2.0f]; 要么 self.imageView.animationImages = listOfMyImageNames; self.imageView.animationRepeatCount = 0; self.imageView.animationDuration = 2; [self.imageView startAnimating]; 我知道UIImageView解决scheme提供了更多的循环数量的灵活性,但我想要一个无限的animation,在这种情况下无关紧要。

我怎样才能将UIImage添加到我的PFFile数组,以便如果查询PFFIle图像失败,它可以通过附加一个UIImage?

从Parse中检索图像,并在tableView上显示它们,如果我向下滚动tableView,应用程序崩溃,并给我“致命错误:数组索引超出范围” 行数由“messagesArray”中的消息数给出 我认为问题是,在查询中,如果我没有find图像的指针,我说:“附加到PFFile数组这个标准的UIImage我的称为”标志“”所以当我向下滚动,计数imagesArray和messagesArray doesn马克。 我怎样才能将UIImage添加到我的PFFile数组,以便如果查询PFFIle图像失败,它可以被replace为附加UIImage? 有些人告诉我为dispatch_async(dispatch_get_main_queue()) {}的图像做一个单独的查询。 但是主查询就是这样调用的。 我有这个数组: var picturesArray : [PFFile] = [] 在cellForRowAtIndexPath我有: self.picturesArray[indexPath.row].getDataInBackgroundWithBlock { (imageData: NSData?, error:NSError?) -> Void in if error == nil { let image = UIImage(data: imageData!) cell.senderProfileImage?.image = image } else { print("plan B") cell.senderProfileImage?.image = UIImage(named: "logo") } } 在我的查询中,我可以通过查询指向_Users的“发件人”列来_Users发件人的_Users 。 我有: if let theName = […]

制作一个拉出式托盘 – (iOS)

我正在制作一个iPad应用程序,基本上,我想制作一个从应用程序底部拉出的托盘,并且我希望在屏幕底部有一个小标签,如果您拉动,它会带来形成图像,图像的高度将与您按下button的高度相匹配。 这有点像通知中心如何工作,除了标签总是可见的。 所以我的问题是,我将如何让图像跟随标签,因为它在屏幕上垂直移动? 我会假设使用一个UIButton的标签和托盘的UIImage将是有道理的,我有一些代码让button移动,但你怎么能使一个对象跟随另一个? 谢谢你的帮助,卡尔

UIPickerView UIImage和Segue

在我的应用程序中,我在我的UserView中使用UIImagePickerCollection相机。 但一旦用户select“使用照片”,我想在另一个视图“cameraView”,因为我有一些待遇做我的照片。 这是我的代码: -(void)takeAPicture{ NSLog(@"CHEESE"); UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; imagePicker.mediaTypes = @[(NSString *) kUTTypeImage]; imagePicker.allowsEditing = NO; [self presentViewController:imagePicker animated:YES completion:nil]; } -(void)imagePickerController: (UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [self dismissViewControllerAnimated:YES completion:^{ _img = [info objectForKey:UIImagePickerControllerOriginalImage]; if ([picker sourceType] == UIImagePickerControllerSourceTypeCamera) { UIImageWriteToSavedPhotosAlbum(_img, nil, nil, nil); }}]; [self […]

iOS将图像和数据发布到PHP mySQL数据库

我试图张贴多个图片连同文本数据到我的PHP页面,然后到mySQL数据库,但我得到一个400错误响应,我无法发布任何东西。 我能够只发布数据或只有图片,但不能两个在一起。 看来我没有正确设置POST。 我需要张贴很多图片,但是现在只是想要一个滚动 。 任何帮助将不胜感激! NSData *imageData = UIImageJPEGRepresentation(_image1.image, 10); //Add boundary NSMutableString *boundary = [NSMutableString stringWithString:@"—-Boundary+"]; //Append 5 random chars to the end of the boundary for(int i = 0; i < 5; i++){ BOOL lowercase = arc4random() % 2; if(lowercase){ [boundary appendFormat:@"%c", (arc4random() % 26) + 97]; } else { [boundary appendFormat:@"%c", […]

iOS使用Quartz旋转UIImage

我有一个自定义的UIView子类 – (void)drawRect:(CGRect)rect 我想在位置50,50绘制一个UIImage,并旋转20度。 我试了下面的代码: CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGContextRotateCTM (context, degreesToRad(20)); [image drawAtPoint:CGPointMake(50, 50)]; CGContextRestoreGState(context); 它正确旋转图像,但它不是在50,50 … 如何在保持正确坐标的同时旋转UIImage?

IOS – 从Parse.com后端下载图片

或者我有一个应用程序,一直从parsing后端下载大图像。 在android中,您可以使用它们的URI将图像下载为stream,并将特定的尺寸大小设置为我要下载的位图。 通常这是通过使用BitmapFactory库来完成的,并允许我下载一个缩小尺寸的位图,从而节省我的应用程序的时间。 在IOS平台上有这个方法吗? 这是我目前正在做的,但是当我下载15全尺寸的图像,我得到了大量的加载时间: //where photoQuery is a Parse.com database query that returns the photo as the first object PFObject *photoObject = [photoQuery getFirstObject]; PFFile *photoFile = (PFFile *)[photoObject objectForKey:@"fullSizedImage"]; UIImage *fullImage = [UIImage imageWithData:photoFile.getData]; IOS是否支持类似于BitmapFactory或这个常见的Androiddevise模式?

使用CGContextRef在大尺寸图像上绘制线条后,在iPad中接收内存警告

我使用CGContextRef在UIImage上绘制线条。我的图像像3000×4500这样的分辨率非常大。如果绘制一条线,它不会给我记忆警告,但是如果我绘制多条线,那么会给出内存警告,之后我的应用程序崩溃。试图释放CGContextRef对象,但得到一个错误。 我的代码: UIGraphicsBeginImageContext(imageView.image.size); [imageView.image drawAtPoint:CGPointMake(0, 0)]; context2=UIGraphicsGetCurrentContext(); for(int i=0; i<kmtaObject.iTotalSize; i++) { kmtaGroup=&kmtaObject.KMTA_GROUP_OBJ[i]; //NSLog(@"Group # = %d",i); for (int j=0; j<kmtaGroup->TotalLines; j++) { lineObject=&kmtaGroup->Line_INFO_OBJ[j]; // NSLog(@"Line # = %d",j); // NSLog(@"*****************"); x0 = lineObject->x0; y0= lineObject->y0; x1= lineObject->x1; y1= lineObject->y1; color= lineObject->Color; lineWidth= lineObject->LinkWidth; lineColor=[self add_colorWithRGBAHexValue:color]; linearColor=lineColor; // Brush width CGContextSetLineWidth(context2, lineWidth); // Line Color […]

困惑什么对象实际上包含捕获的图像时使用AVFoundation

我有一个使用AVFoundation的照片应用程序。 到目前为止,一切正常。 然而,令我困惑的一件事情是,被捕获的图像实际上包含了什么对象? 我已经NSLogging所有的对象和他们的一些属性,我仍然不知道捕获的图像包含在哪里。 这是我设置捕获会话的代码: self.session =[[AVCaptureSession alloc]init]; [self.session setSessionPreset:AVCaptureSessionPresetPhoto]; self.inputDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; NSError *error; self.deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:self.inputDevice error:&error]; if([self.session canAddInput:self.deviceInput]) [self.session addInput:self.deviceInput]; self.previewLayer = [[AVCaptureVideoPreviewLayer alloc]initWithSession:self.session]; self.rootLayer = [[self view]layer]; [self.rootLayer setMasksToBounds:YES]; [self.previewLayer setFrame:CGRectMake(0, 0, self.rootLayer.bounds.size.width, self.rootLayer.bounds.size.height)]; [self.previewLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill]; [self.rootLayer insertSublayer:self.previewLayer atIndex:0]; self.stillImageOutput = [[AVCaptureStillImageOutput alloc] init]; [self.session addOutput:self.stillImageOutput]; [self.session startRunning]; } […]

如何获得UIImage的图像作为NSString?

我需要得到一个string的UIImage的图像的值。 以前我在做: if(images[imageNo].image == [UIImage imageNamed:@"image1.png"]) { 但现在我有更多的条件,所以我想用一个开关,做: switch(images[imageNo].image) { case @"image1.png": break; } 有没有办法做到这一点? 谢谢!