uiimageview

Cache tableView Cell data

穿精又带淫゛_ 提交于 2019-12-12 06:32:52
问题 In my application I'm downloading some images using the URL and put them in the cell.imageView[indexPath.row] (it's a custom cell with an imageView inside). I can see two cells at a time and I noticed that the method func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> CustomCell { } It's called every time the cell will be displayed. So my app continue to download the image from the server and the app result very slow. I would like to know if it's possible

IOS: a quickly way to set an image in a imageview

怎甘沉沦 提交于 2019-12-12 06:27:57
问题 If I have an imageview of 77x77 and I want to adapt an UIImage in this imageview, is it possible? at the example I want set in this imageview an image with a size of 300x200, is there a way to adapt this image inside this imageview (77x77) ?? thanks 回答1: Yes, myImageView.contentMode = UIViewContentModeScaleAspectFit; The property is inherited from UIView. UIViewContentMode Specifies how a view adjusts its content when its size changes. typedef enum { UIViewContentModeScaleToFill,

Remove Line from UIImageView

纵饮孤独 提交于 2019-12-12 05:27:32
问题 I have drawn a straight line on UIImageView. Now I want to remove that drawn line if user taps on it. Here is my code for drawing a line on Image. - (void)handleLongPressGestures:(UILongPressGestureRecognizer *)sender { if (sender.state == UIGestureRecognizerStateEnded) { CGPoint location=[sender locationInView:imageView]; CGPoint contextLocation = CGPointMake(location.x*imageView.image.size.width/imageView.frame.size.width, location.y*imageView.image.size.height/imageView.frame.size.height);

Aspect ratio constraint relative to the screen width

随声附和 提交于 2019-12-12 05:18:05
问题 I have set a cell image to my UITableViewCell . It is a custom cell. I have set the aspect ratio as 1:1 and the width of the image view to 50. But for iphone 5 and 5s this size is too big as I feel. So how can I change the size of the UIImageView relative to the screen width. Please help me. Thanks This is my current view 回答1: There are at least 2 ways you could configure image size based on the screen size: Size-Classes allows you to set different width constraint value based on Trait

How to show image from the imagePath in swift3

我们两清 提交于 2019-12-12 04:57:33
问题 I have response from soap as image_path (self.posts.value(forKey: "image_path") as! [String])[indexPath.row] This is my response "http://sf.iipl.info/ImageCSharp.aspx?Location=C:\\infinityhost\\demo11.iipl.info\\data\\app\\user_location_photo\\8000034939_Resize\\&FileName=1_35f28e55-ca31-4918-8b41-9eb7f3070ace" i cant convert this response to my url, i want to show this image in my tableViewCell public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) ->

IOS: animation with UIImageView

ぐ巨炮叔叔 提交于 2019-12-12 04:46:59
问题 I have two imageViews that I call firstView and secondView; I have to do an animation that move a third imageView that I call imageView3. This imageView3 is inside firstView and I do this code [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; [imageView3 setFrame:frameinSecondView]; [UIView commitAnimations]; //[imageView3 removeFromSuperview]; //[secondView addSubview:imageView3]; with this code I can move imageView3 to secondView but the problem is that I'm not

Image is not being shown when using UIImage imageWithData:NSData dataWithContentsOfFile

两盒软妹~` 提交于 2019-12-12 04:42:58
问题 The below code is not displaying the image which is downloaded from online and written into my application documents directory. i have checked inside the iphone's simulator documents directory , the downloaded file is exist. but the image is not displayed. When trying to add a resources image using UIImage *imgBack = [UIImage imageNamed:@"btn-back.png"]; , the uiimageview displays the image.bu the image which is downloaded from online and stored inside the app directory is not displaying the

Why rotating imageView, it changes position?

会有一股神秘感。 提交于 2019-12-12 04:34:03
问题 when I use: ImageView.transform = CGAffineTransformRotate(ImageView.transform, rotation); everytime I rotate imageView and I NSLog(@"x:%f y:%f", ImageView.frame.orgin.x, ImageView.frame.orgin.y), x and y always change value?? Why? 回答1: Well the .frame.origin is the top left corner of you UIImageView and since you are rotating it the top left corner is moving. If you access the .center it should stay the same. 回答2: The UIView documentation states that Warning: If this property is not the

NSArray returning NULL value even though right number of objects is counted and returned

一世执手 提交于 2019-12-12 04:25:25
问题 I have created a NSArray that contains images objects. Based on the swipe direction recognized by UISwipeGestureRecognizerDirection the index is incremented up or down so the right image could be selected. The problem I have is that my NSArray is returning a NULL value instead of the image object. Therefore the UIImageView (named imageView) displays nothing. I am printing an NSLog statement in order to see what is really happening - example below: ... [2307:60b] Swiped and the index is: 1,

How to save only UIImageView not the whole screen in my photo app. In Swift

人走茶凉 提交于 2019-12-12 04:17:03
问题 My app has a camera section. It takes a photo and then puts a watermark on the photo. However when the photo is saved, the whole screen is saved, not just the UIImageView . I just want the UIImageView to be saved. It's not that but because the menu bar at the button is not that big. I just think it would look better without the menu bar in the picture. Photo of app just before taking photo: Photo of how the picture taken is saved: This is my code below. import UIKit class Camera: