uiimageview

How do I animate opacity using swift?

北城余情 提交于 2019-12-19 18:28:46
问题 Could someone please provide me with an example of animating the opacity of an Image View in swift?? I couldn't even find a good example in objective c func showCorrectImage(element: AnyObject){ var animation : CABasicAnimation = CABasicAnimation(keyPath: "opacity"); animation.delegate = self animation.fromValue = NSValue(nonretainedObject: 0.0) animation.toValue = NSValue(nonretainedObject: 1.0) animation.duration = 1.0 element.layer?.addAnimation(animation, forKey: nil) } I think I have

UIImageView zoom and pinch in UIScrollView

≯℡__Kan透↙ 提交于 2019-12-19 11:57:10
问题 I have tried many different ways of implementing expand image and pinch to zoom. I have found tutorials on how to do this with images saved in my project however I am retrieving my images from Firebase. I would like one image to take about half the ProfileViewController screen and the other pictures to be able to be expanded full page and also have the ability to zoom. My code I have for it now does this however the zooming and the position is not clean or easy to use. var newImageView:

how to perform Bump Distortion in ios 5.0?

落爺英雄遲暮 提交于 2019-12-19 11:48:06
问题 i need to perform Bump Distortion in ios 5.0 ... my xcode doesn't show any error and also i am not get any output ... while trace and print the Bump filter instance it prints the null value... any idea about that... some of the post shows that was not work in ios 5.0, any other way is there to perform the Bump Distortion... Thanks in advance.... Regards, Spynet My code... context = [CIContext contextWithOptions:nil]; CIFilter *bumpDistortion = [CIFilter filterWithName:@"CIBumpDistortion"];

Capturing of Screen shot starting from 0,0

亡梦爱人 提交于 2019-12-19 11:18:03
问题 I am using following code to make a screen shot UIGraphicsBeginImageContext(self.view.frame.size); blendMode:kCGBlendModeClear alpha:1.0]; [self.view.window.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil); return viewImage; It is working fine but it returns the full screen, and I want a screen shot of a particular Frame, like ( 100,100

Scaling UIImage with a UIIImagePicker's CGAffineTransform and Saving to Parse SDK

心不动则不痛 提交于 2019-12-19 09:09:22
问题 I use the following code to scale my UIImagePickerController . CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 71.0); //This slots the preview exactly in the middle of the screen by moving it down 71 points self.imagePicker.cameraViewTransform = translate; CGAffineTransform scale = CGAffineTransformScale(translate, 1.333333, 1.333333); self.imagePicker.cameraViewTransform = scale; Then I take the picture and present it in a UIImageView - (void)imagePickerController:

Adding padding and border to an UIImageView

一个人想着一个人 提交于 2019-12-19 06:03:18
问题 How can I add padding between an UIImageView and its border? Img.layer.cornerRadius = Img.bounds.width / 2 Img.layer.borderWidth = 2 Img.layer.borderColor = UIColor.blue.cgColor Img.clipsToBounds = true Like this: 回答1: As per the this link class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let image = UIImage(named: "imagename")! let imageView = UIImageView(image: image.imageWithInsets(insets: UIEdgeInsetsMake(30, 30, 30, 30))) imageView.frame = CGRect

Want smooth transition or slide between pictures in an NSArray using UISwipeGesture

时间秒杀一切 提交于 2019-12-19 03:15:53
问题 I have a UIImageView as one of my tabbarcontroller views, and I've added a UISwipeGestureRecognizer (right and left) to navigate through a series of photos in an NSArray. However, when swiping it jumps from photo to photo with no smooth transition. I'm not after anything fancy, but even a slide animation would be okay, like as one photo slides in, the other is sliding out the other side. Is this possible with the UISwipeGestureRecgonizer and an NSArray? 回答1: The standard solution is to use a

UITapGestureRecognizer not working in UIImageView

好久不见. 提交于 2019-12-18 18:38:06
问题 I had the following code: UITapGestureRecognizer *showStoryTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showNewsStory:)]; [showStoryTapRecognizer setDelegate:self]; [self.storyImageView_ addGestureRecognizer:showStoryTapRecognizer]; [showStoryTapRecognizer release]; This however doesn't trigger the showNewsStory, why is this? I have enabled userInteraction in the image view. 回答1: UITapGestureRecognizer *oneTouch=[[UITapGestureRecognizer alloc

UIImage aspect fit and align to top

a 夏天 提交于 2019-12-18 18:33:12
问题 It looks like aspect fit aligns the image to the bottom of the frame by default. Is there a way to override the alignment while keeping aspect fit intact? ** EDIT ** This question predates auto layout. In fact, auto layout was being revealed in WWDC 2012 the same week this question was asked 回答1: In short, you cannot do this with a UIImageView . One solution is to subclass a UIView containing an UIImageView and change its frame according to image size. For example, you can find one version

Lazy Loading of several images in UITableView

风格不统一 提交于 2019-12-18 18:23:30
问题 What are the best practices to download several images and load each of them in a UIImageView which is inside a UITableViewCell? Particularly, should I resize/replace the UIImageview after downloading or should I resize the image to fit into the UIImageView. Note that resizing/replacing UIImageView also resize/replace UITableViewCell. Will it cause any issue? 回答1: A couple of thoughts: What are the best practices to download several images and load each of them in a UIImageView which is