Tag: 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); }

AFNetworking预取其他图像

我正在使用UIImageView + AFNetworking类别从URL数组下载和显示图像,并填充表视图。 现在我发现其他图像被延迟,因为只有当前单元格的图像将被加载。 我也需要通过提取其他图像来保持忙碌。 我的想法是编写一个for循环,并开始使用AFNetworking下载和caching,比如starting from current indexPath 10个其他请求。 还是应该在完成块中执行通常的dispatch_async并开始获取提及的20个其他图像? 任何更好的想法?

在ios中的图像滚动查看

您好我的要求是scrollview显示图像,应显示下一个和上一个button。用户可以滚动图像以及使用button来移动图像。 我怀疑如何获得index / tag /图像名称或其他任何东西时,基于该值的button滚动应更新。 这是我的代码 [self arrayInitiaisation]; scrollview.pagingEnabled = YES; scrollview.alwaysBounceVertical = NO; scrollview.alwaysBounceHorizontal = YES; NSInteger numberOfViews = 4; for (int i = 0; i < numberOfViews; i++) { CGFloat xOrigin = i*320; imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"image%d",i+1]]; imageView.contentMode = UIViewContentModeScaleAspectFit; [self.scrollview addSubview:imageView]; imageView.tag = i; … 数组初始化方法 -(void) arrayInitialisation { count=0; [super […]

如何创build一个移动的图像

我如何创build一个移动到屏幕上的图像? 所以它从底部出现,当完全可见时停止。 我也会玩速度和方向。 这不像Apple的PhotosSroller示例所示的照片滚动

拖动,缩放和旋转多个UIImageviews

到目前为止,我可以移动,缩放和旋转所有对象,但是多个对象一起移动。 我希望他们分开移动。 我想我必须改变objectatIndex为1,但它只是崩溃。 我已经使用了下面的代码: – (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSArray *allTouches = [touches allObjects]; UITouch* t; if([[event allTouches] count]==1){ if (CGRectContainsPoint([Birdie frame], [[allTouches objectAtIndex:0] locationInView:theimageView]) && CGRectContainsPoint([imageViewauto frame], [[allTouches objectAtIndex:0] locationInView:theimageView])) { t=[[[event allTouches] allObjects] objectAtIndex:0]; touch1=[t locationInView:nil]; } }else{ t=[[[event allTouches] allObjects] objectAtIndex:0]; touch1=[t locationInView:nil]; t=[[[event allTouches] allObjects] objectAtIndex:1]; touch2=[t locationInView:nil]; } } […]

在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 […]

在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,在这种情况下无关紧要。

UIImageView没有响应居中

我正在尝试为iOS设置一个简单的指南针。 旋转animation似乎围绕屏幕中心旋转指南针图像,所以我正在尝试自动居中指南针图像的UIImageView,以便它可以在不同的设备上工作。 这是我的问题所在。 我试图用ViewDidLoad中的下面的代码中心图像,但没有结果: compassImage.center = CGPointMake(CGRectGetMidX(self.view.frame), CGRectGetMidY(self.view.frame)); 我最初把罗盘图像放在故事板内的一个随机的地方,以确保这个工作。 我已经打印NSLog检查之前和之后这个居中代码,以确保它是有效的,它似乎是居中图像(在我的iPhone 4s),但这并不反映在视图中: 2014-05-17 12:18:23.015 Compass[447:60b] Old: 160, 386 2014-05-17 12:18:23.019 Compass[447:60b] New: 160, 240 我会张贴一个图像,但不被允许,因为这是我的第一篇文章。 事实上,这整个设置。 我确定我在某个地方出了问题: ViewController.h #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> #import <QuartzCore/QuartzCore.h> @interface ViewController : UIViewController <CLLocationManagerDelegate> @property (nonatomic, retain) CLLocationManager *locationManager; @property (nonatomic, retain) IBOutlet UIImageView *compassImage; @property (nonatomic, retain) IBOutlet UILabel *trueHeadingLabel; […]

如何获得由AFNetworking的UIImageView类别存储的caching图像?

我在我的应用程序中使用UIImageView+AFNetworking.h以下类别的UIImageView+AFNetworking.h ,它的工作正常,它为我caching照片,并顺利加载图像。 有一次,我想获得一个已经在我的caching中的图像。 所以我挖掘到以上类别类,我发现以下代码,我认为 – 可以是有益的。 这是它的片段: @implementation AFImageCache – (UIImage *)cachedImageForRequest:(NSURLRequest *)request { switch ([request cachePolicy]) { case NSURLRequestReloadIgnoringCacheData: case NSURLRequestReloadIgnoringLocalAndRemoteCacheData: return nil; default: break; } return [self objectForKey:AFImageCacheKeyFromURLRequest(request)]; } – (void)cacheImage:(UIImage *)image forRequest:(NSURLRequest *)request { if (image && request) { [self setObject:image forKey:AFImageCacheKeyFromURLRequest(request)]; } } @end 如果你想要我添加这个网页版本,它已经在这里 。 我认为, – (UIImage *)cachedImageForRequest:(NSURLRequest *)request是可以返回我的caching图像的方法。 […]

在Collectionview问题iOS中的单元格中添加复选标记图像

我试图添加复选标记图像单元格,但我有一个问题,我只是select1单元格,虽然我设置multiselection = YES为collectionview。 还有另外一个问题是当我滚动collectionview时,选中的单元格被重用,所有复选标记图片都是不正确的。 以下是我使用的代码。 – (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { TDPhotoCell *photoCell = [collectionView dequeueReusableCellWithReuseIdentifier:TDPhotoCellIdentifier forIndexPath:indexPath]; TDPhoto *photo = self.photosArray[indexPath.row]; [photoCell.photoImage sd_setImageWithURL:photo.imageURL placeholderImage:[UIImage imageNamed:@"placeholder.png"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { [activity removeFromSuperview]; }]; if (self.isSelectMode) { // check the selected photo if (self.selectedItemIndexPath != nil && [indexPath compare:self.selectedItemIndexPath] == NSOrderedSame) […]