uiimageview

How can I dynamically set the size of the imageView according to the size of the image

巧了我就是萌 提交于 2019-12-11 19:19:32
问题 I user Interface Builder to layout my view and image view. I put a imageView on the view and set it as an outlet. The problem is that no matter what size of image (768*1024、1024*700) I set in my program: self.imageView.image = [UIImage imageNamed:self.filename]; The size to be on the screen is always the size of the imageView I set in the Interface Builder. How can I dynamically set the size of the imageView according to the size of the image? Thanks! 回答1: Something like: UIImageView

Removing lines from UIImage in ios

为君一笑 提交于 2019-12-11 19:06:53
问题 I have an image in UIImageView. I have drawn lines on the image sucdcessfully.Now I want to remove that specific line on which user will perform a long press gesture. how can I do that ? my code is : { // 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

Moving UIImage view Dynamically when Autolayout is enabled

a 夏天 提交于 2019-12-11 18:58:56
问题 i have to move a UI image view according to the the value received. I have enabled Autolayout. and i must use auto layout. Is there any other method to move my UIImage view. This is the Code i am using and i know it wont work as i have enabled Auto layout switch (valueForBlueBar) { case 0: NSLog(@"its Monday"); break; case 1: NSLog(@"its tuesday"); break; case 2: NSLog(@"its wednesday"); break; case 3: NSLog(@"its thurdsay"); [blueBarOutlet setFrame:CGRectMake(100, 100, blueBarOutlet.frame

Zoom in Scroll view with UIImage

試著忘記壹切 提交于 2019-12-11 18:53:33
问题 Im trying to zoom in a scroll view with multiple images, the scroll view only scrolls vertical, i tried to implement many ways, in many examples but none seens to work. Heres the code im using to create the images and the scroll view: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. for (int i = 0; i < 6; i++) { UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"amap1%i.png",i+1]]; // create imageView _imageView = [

UIButton is not responding when added to a UIImageView

情到浓时终转凉″ 提交于 2019-12-11 18:07:02
问题 I'm trying to add a button to a UIImageView with a transparent background - the button is shown ok but is not responding. (takePictureClicked is not called) My code: cameraController = [[UIImagePickerController alloc] init]; cameraController.sourceType = UIImagePickerControllerSourceTypeCamera; cameraController.delegate = self; cameraController.allowsEditing=YES; cameraController.showsCameraControls = NO; cameraController.navigationBarHidden = YES; cameraController.toolbarHidden = YES; //

UIImageViewer does't update its contents until methods finish, not as the commands are executed

断了今生、忘了曾经 提交于 2019-12-11 17:52:21
问题 Okay, I have a problem with my code. I want to make some sort of grid like game using imageViewers, but when the method that changes the pictures which the imageViewers how, it only updates the screen/imageviewers once it is finished executing, not when the line that does it is actually executed. I has a method with an infinite loop in it and it changes the pictures of the imageViewers as you press buttons. The buttons call methods which change a boolean variable to true, so the main game

Why doesn't image load on main thread?

北城以北 提交于 2019-12-11 17:48:31
问题 I'm using this code to load an image from a URL: Loading/Downloading image from URL on Swift. That is working fine. I've take the code out of the viewcontroller and put it into a class. Now the image only loads when I step through the code. I'm guessing this has something to do with the code running fine but everything finishes executing before the image has completely downloaded from the web. What piece of this am I missing so the code waits for the image without holding up any other code

How to get the frame size of a UIImageView in a UICollectionView cell

狂风中的少年 提交于 2019-12-11 17:42:59
问题 I'm trying to get the frame size of a UIImageView inside a UICollectionViewCell . I have currently tried to achieve this using thumbnailImageView.frame.size but this returns (0.0, 0.0) no matter where I call this method from. The reason I want to do this is to round the edges of the image inside the image view, but as I am using .scaleAspectFit I need to know the frame size and image size to correctly round the corners. Below is the cell class: class SomeCollectionViewCell:

UIPinchGestureRecognizer selector not getting called on UIImageView

人走茶凉 提交于 2019-12-11 17:38:00
问题 I've been trying to figure this out for hours, completely at a loss here. I'm trying to implement a UIPinchGestureRecognizer for some of the custom UIImageViews in my game, but it doesn't work. Everything thing I've researched says it should work, yet it doesn't. Pinch works fine if I add it to my view controller, or to a custom UIView, but not the UIImageViews. I've tried all the common fixes and tweaks, to no success. I have userInteractionEnabled and multipleTouchEnabled set to YES. I have

Adding a UIImageView to UIButton

天涯浪子 提交于 2019-12-11 17:31:18
问题 I created a UIScrollView which contains several UIImageView instances. The SDWebImage framework is used in order to cache images and present them in the UIImageView instances. Now I want to be able to click on these instances of UIImageView. Previously I added UIButtons to the UIScrollView and added an image to this button. But know I am not able to add a UIImageView to a button. How should I solve this? is it an option to place an UIButton over this view? and how should I do this? I