Tag: 图像

UIImageView不会更新照片后的新图像或从照片库中select图片

我试图在UIImageView中填充图像后,我可以拍照或从我的照片库中select一张图片。 这里是处理相机和照片库激活的代码: @IBAction func activateCmera(_ sender: Any) { if (UIImagePickerController.isSourceTypeAvailable(.camera)) { let imagePicker = UIImagePickerController() imagePicker.delegate = self imagePicker.sourceType = .camera imagePicker.allowsEditing = false self.present(imagePicker, animated: true, completion: nil) } } @IBAction func activatePhotoLib(_ sender: Any) { if (UIImagePickerController.isSourceTypeAvailable(.photoLibrary)) { let imagePicker = UIImagePickerController() imagePicker.delegate = self imagePicker.sourceType = .photoLibrary imagePicker.allowsEditing = false self.present(imagePicker, animated: […]

ios – 水平滚动collectionView与图像

我正试图在collectionView上显示图像。 我有麻烦显示这个图像,因为我已经创build了一个可重复使用的单元格与imageView内部。这些图像必须等间隔,因为我想在屏幕上一次显示3个图标。 我使用13个图标,它必须通过屏幕水平滚动。 我不能在单元格中显示图像,我不知道如何使用一个可重用的单元格来设置图像单元之间的间距 CustomCollectionViewCell.h @interface CustomCollectionViewCell : UICollectionViewCell @property (nonatomic, retain) UIImageView *imageView; @end CustomCollectionViewCell.m @implementation CustomCollectionViewCell – (UIImageView *) imageView { if (!_imageView) { _imageView = [[UIImageView alloc] initWithFrame:self.contentView.bounds]; [self.contentView addSubview:_imageView]; } return _imageView; } – (void)prepareForReuse { [super prepareForReuse]; [self.imageView removeFromSuperview]; self.imageView = nil; } @end LandingViewController.m – (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(nonnull […]

开源的库,在iOS上构build全景照片?

有没有人知道这样的图书馆? 我想在iPhone上玩这个function,但不想从头开始编写代码。 PanoramaGL没有帮助,因为它只处理显示全景而不是build立它。 希望很快听到你的Cheere Fadi

在UITableView图像上慢速滚动

我显示了很多直接从我的应用程序加载的图像(未下载)。 当我第一次滚动时,我的表格视图很慢。 所有我的细胞显示后,它变得光滑。 我不知道为什么。 我有一个我加载在viewDidLoad中的UIImage数组。 然后在我的tableview委托,我只是在给定的索引path获取图像,并将其设置为我的单元格的UIImageView。 你知道我怎样才能提高表演?

iPhone的图像video问题在video速度

我已经完成了图像到iPhonevideo转换(当然,我从堆栈溢出问题得到的代码)。 但问题是录制video的速度非常快,即使我有2250帧左右,它在2秒内跑掉了。 我知道问题是与帧率。 但是我不知道如何使它正确。 我的代码在下面 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [paths objectAtIndex:0]; NSString *myFilePath = [documentsDirectoryPath stringByAppendingPathComponent:@"test.mov"]; if ([self openVideoFile:myFilePath withSize:CGSizeMake (480.0, 320.0)]) { for (int i=1; i<2226; i++) { NSString *imagename=[NSString stringWithFormat:@"1 (%i).jpg",i]; UIImage *image=[ UIImage imageNamed:imagename]; [self writeImageToMovie:[image CGImage]]; } [videoWriter finishWriting]; } else { NSLog(@"friled to open video […]

IOS用名字保存图像

我有一个应用程序,拍摄一张照片,并与另一个图像合并。 我希望能够显示在应用程序(和只有我的应用程序)拍摄的图像,并显示在画廊视图。 我遇到的问题是分配图像的名称。 我尝试了很多不同的方法 第一次尝试 UIImageWriteToSavedPhotosAlbum(newImage, nil, nil, nil) 这保存了图像,但我不知道如何检索它 第二次尝试 PHPhotoLibrary.sharedPhotoLibrary().performChanges({ let assetRequest = PHAssetChangeRequest.creationRequestForAssetFromImage(newImage) }, completionHandler: { (success, error) -> Void in if success { //image saved to photos library. print("image saved") } }); 与第一次尝试相同的问题 第三次尝试 let date :NSDate = NSDate() let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd'_'HH:mm:ss" dateFormatter.timeZone = NSTimeZone(name: "GMT") let […]

iOS – 从目标C中的Web服务器加载图像

目前,我的目标是编写一个包含UIImageView的应用程序。 加载或按下button后,来自Web服务器的图像将加载到视图中。 什么是最简单的方法来做到这一点? 我假设使用这里描述的API? https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html 与此同时,我将继续努力使自己的工作。 任何意见,将不胜感激,特别是如果你有这样的书面代码之前。

在iOS中使用UIDocumentIntractionController将图像共享到WhatsApp

在iPhone应用程序开发中,是否可以使用UIDocumentIntractionController或API从iOS应用程序共享图像和文本到WhatsApp ?

添加图片iOS xCode

所以我试图将我的Android应用程序之一转换为iOS。 在Android中,我们只有一个可绘制的文件夹来存储图像。我对iOS和xCode非常新,我试图在这里find类似的东西,但是我没有,所以我只是创build了一个图像文件夹,并将所有资源添加到它。 我添加了一个button,并将背景属性设置为我添加的图像之一。 这在xCode中的显示效果很好,但是当我在模拟器中运行这个时,我得到以下错误: 2016-03-20 00:31:20.617 City[588:12453] Could not load the "btn_back_rev.jpg" image referenced from a nib in the bundle with identifier "citylife.City" 这是图像: 以及它在Main.Storyboard中引用的方式: <resources> <image name="btn_back_rev.jpg" width="320" height="60"/> </resources>

WhatsApp图像共享不起作用

我的类实现了UIDocumentInteractionControllerDelegate ,我有以下属性: @property (nonatomic,retain) UIDocumentInteractionController * documentInteractionController; if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]]) { UIImage *iconImage = [UIImage imageNamed:@"bg_iPhone_5.jpg"]; NSString *savePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/whatsAppTmp.wai"]; [UIImageJPEGRepresentation(iconImage, 1.0) writeToFile:savePath atomically:YES]; _documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]]; _documentInteractionController.UTI = @"net.whatsapp.image"; _documentInteractionController.delegate = self; [_documentInteractionController presentOpenInMenuFromRect:CGRectMake(0, 0, 0, 0) inView:self.view animated: YES]; } else { UIAlertView * alert = [[UIAlertView […]