uiimageview

Creating a shadow for a UIImageView that has rounded corners?

▼魔方 西西 提交于 2019-12-17 08:52:47
问题 I am trying to create an ImageView that has rounded corners and a shadow to give it some depth. I was able to create a shadow for the UIImageView , but whenever I added the code to also make it have rounded corners, it only had rounded corners with no shadow. I have an IBOutlet named myImage , and it is inside of the viewDidLoad function. Does anybody have any ideas on how to make it work? What am I doing wrong? override func viewDidLoad() { super.ViewDidLoad() myImage.layer.shadowColor =

Animated gif not working in MKMapView overlay using MKOverlayRenderer

≡放荡痞女 提交于 2019-12-17 06:45:31
问题 I am trying to display an animated gif in an overlay for MKMapView . The overlay is created using the MKOverlayRenderer . To animate the gif in iOS 7, I'm using the UIImage+animatedGIF category posted here on GitHub. The image of the animated gif displays fine in the overlay using the category; however, the gif does not animate. I have no problem using the category to animate a gif in a UIImageView but it does not seem to work correctly in a map view overlay. How can I use this category to

UIImageView pinch zoom swift

佐手、 提交于 2019-12-17 06:28:16
问题 I was hoping someone could help me out. I am trying to allow a user to pinch zoom on a UIImageView(with a max and min level allowed). But for some reason the it does not work right. The image zooms a little then just bounces back. Thank you. here is the zoom func func zoom(sender:UIPinchGestureRecognizer) { if sender.state == .Ended || sender.state == .Changed { let currentScale = self.view.frame.size.width / self.view.bounds.size.width var newScale = currentScale*sender.scale if newScale < 1

How to make a circular UIView

随声附和 提交于 2019-12-17 05:39:31
问题 I want to make a UIView or UIImageView that is a circle. Or a circle that i can change the size of using a slider, and the color of with a pickerview. 回答1: I can at least show you a shortcut for drawing circles of arbitrary size. No OpenGL, no Core Graphics drawing needed. Import the QuartzCore framework to get access to the .cornerRadius property of your UIView or UIImageView. #import <QuartzCore/QuartzCore.h> Also manually add it to your project's Frameworks folder. Add this method to your

UIGestureRecognizer on UIImageView

天涯浪子 提交于 2019-12-17 05:33:30
问题 I have a UIImageView , which I want to be able to resize and rotate etc. Can a UIGestureRecognizer be added to the UIImageView ? I would want to add a rotate and pinch recognizer to a UIImageView which would be created at runtime. How does one add these recognizers? 回答1: Check that userInteractionEnabled is YES on the UIImageView . Then you can add a gesture recognizer. imageView.userInteractionEnabled = YES; UIPinchGestureRecognizer *pgr = [[UIPinchGestureRecognizer alloc] initWithTarget

Picking two different images in the same view controller using imagePickerController in Swift

落爺英雄遲暮 提交于 2019-12-17 05:08:11
问题 I am making an app in which there are two UIImageViews. In each image view the user needs to be able to input a different image. Here is the code I have so far. 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

How to assign an action for UIImageView object in Swift

做~自己de王妃 提交于 2019-12-17 04:39:14
问题 I'm trying to assign an UIImageView to an action when the user taps it. I know how to create an action for a UIButton , but how could I mimic the same behavior of a UIButton , but using a UIImageView ? 回答1: You'll need a UITapGestureRecognizer . To set up use this: override func viewDidLoad() { super.viewDidLoad() let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(imageTapped(tapGestureRecognizer:))) imageView.isUserInteractionEnabled = true imageView

UIImage from CALayer in iOS

旧巷老猫 提交于 2019-12-17 03:35:22
问题 In my application, I have created a CALayer (with a few sublayers - the CALayer is composed of shapes added as sublayers). I am trying to create a UIImage that I will be able to upload to a server (I have the code for this). However, I can't figure out how to add the CALayer to a UIImage . Is this possible? 回答1: Sounds like you want to render your layer into a UIImage. In that case, the method below should do the trick. Just add this to your view or controller class, or create a category on

Resizing UIimages pulled from the Camera also ROTATES the UIimage?

混江龙づ霸主 提交于 2019-12-17 03:00:04
问题 I am getting UIimages from the camera and assigning them to UIImageViews to be displayed. When I do this the camera gives me a 1200 x 1600 pixel image which I then assign to a UIImageView in my Application. The image is displayed as expected in the image view under this condition. However, when I attempt to RESIZE the retrieved UIImage before assigning it to the UIImageView, the image is resizing as expected but there IS a problem in that somewhere (in the RESIZING code?) my UIImage is

Resizing UIimages pulled from the Camera also ROTATES the UIimage?

不羁岁月 提交于 2019-12-17 02:59:15
问题 I am getting UIimages from the camera and assigning them to UIImageViews to be displayed. When I do this the camera gives me a 1200 x 1600 pixel image which I then assign to a UIImageView in my Application. The image is displayed as expected in the image view under this condition. However, when I attempt to RESIZE the retrieved UIImage before assigning it to the UIImageView, the image is resizing as expected but there IS a problem in that somewhere (in the RESIZING code?) my UIImage is