uiimageview

How to create UIButton in UIImageView's top left corner and bottom right corner

半腔热情 提交于 2019-12-24 03:18:15
问题 I wish to create delete button in imageview's top left corner and bottom right corner. but it doesn't look like what I needed. I wish both the buttons should be placed on corner of the Red border To create the button I used the code below UIImageView * tappedView = (UIImageView *)[recognizer view]; [tappedView.layer setBorderColor: [[UIColor redColor] CGColor]]; [tappedView.layer setBorderWidth: 2.0]; tappedView.layer.cornerRadius = 10; tappedView.layer.masksToBounds = NO; UIButton *deleteBtn

Changing color of image embedded to a button (Swift3)

二次信任 提交于 2019-12-24 02:34:13
问题 I am able to change the color of an image of a UIButton from black to white with the following code: extension UIImage { func maskWith(color: UIColor) -> UIImage { UIGraphicsBeginImageContextWithOptions(size, false, scale) let context = UIGraphicsGetCurrentContext()! context.translateBy(x: 0, y: size.height) context.scaleBy(x: 1.0, y: -1.0) context.setBlendMode(.normal) let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height) context.clip(to: rect, mask: cgImage!) color.setFill()

Set tableview cell row height dynamically?

随声附和 提交于 2019-12-24 00:52:06
问题 I have a tableview with a label and an image. in some cells, there is no image as i used imageView.removeFromSuperview() to remove it from the cell. When there is an image in the cell, the row height is 445 and "Custom" is checked off. how can i set the row height dynamically according to how long the label is instead of how long/big the imageview is after i remove the imageview? 回答1: If you want dynamic row height, you can define your constraints (making sure they're unambiguous), set the

moving an object without actually touching the object

混江龙づ霸主 提交于 2019-12-23 23:24:16
问题 I'm a beginner when it comes to iPhone development and i've searched for the answer to this question and haven't found anything yet. What i'm trying to do is allow the user to move an object without actually touching the object (they can touch anywhere on the screen) and as they move the object will go from where it was originally and move in the direction of the users movement but not jump to thier touch location and be covered up by their finger. Any help you can provide would be phenomenal

Incorrect size of Images in TableView

眉间皱痕 提交于 2019-12-23 22:25:54
问题 I am creating a table view with images from an URL, but the images don´t re-size to all the view until I presset it in the row. any idea why that is happening? This is a custom tableview My code is : - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellIdentifier = @"Celula_Noticias"; Celula_Noticias *cell = (Celula_Noticias*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { NSArray * top= [

Memory Leak iOS (UIImageView,UIImage,CGImage) not freed on ARC

北战南征 提交于 2019-12-23 21:03:56
问题 Im trying to implement a simple video stream but for some reason my memory won't get freed: (void)updateImage:(UIImage *)image{ self.indicator.hidden = TRUE; //CGImageRelease([self.imageView.image CGImage]); self.imageView.image = nil; self.imageView.image = image; [self.imageView setNeedsDisplay]; } If I use CGImageRelease([self.imageView.image CGImage]); memory will be freed. But when I return to a previous view controller the app will crash as it tries to free the allocated memory for that

Consistent use of UIImageView on the UITableViewCells in different UITableViewControllers

霸气de小男生 提交于 2019-12-23 17:27:43
问题 I have a simple 4-tab UITabBarController , with each tab consistent of a UITableViewController . The first Tab is called Videos , the second is Languages , the third is Favourites and the fourth is Leaflets . The Videos Tab contains a list of languages (about 6) and when a cell is clicked on, a segue is performed to show the available videos of that language. The Languages tab is a list of all Languages in the app. When a cell is clicked on, the available Leaflets and Videos for that language

How to rotate an Image on touch and Drag image over another Image

∥☆過路亽.° 提交于 2019-12-23 17:16:04
问题 I'm developing an app where I need a gallery which will have many images. And what I want to do is when user Tap/click on any image it should rotate that image to 90 degree, And if user drag any image to the top of any other image then those images should switch their places (or we can say swap places with each other). Explanation: A B C D E F Suppose above is the images of my gallery so if user drag image A on top of image E then gallery should look like this E B C D A F I'm using

iOS solution to load images with animation only if they are not already cached in memory with SDWebImage

ⅰ亾dé卋堺 提交于 2019-12-23 16:28:08
问题 I've been struggling with this problem for a couple of days now. Previously I used AFNetworking category to load and cache images, but it doesn't provide a cache type in it's callbacks. So I used to keep track in each controller which images have been already loaded. I looked through SDWebImage and it provides exactly what I was looking for - SDImageCacheType . Now i'm trying to come up with an easy to use (hopefully a one-liner) solution to load images in table and collection views with

iOS Aspect Fill Image Resizing with Content Aligned to Left/Top Edge

徘徊边缘 提交于 2019-12-23 16:06:56
问题 I am developing a universal app for iOS-7. this particular question is specific to iPad only. I want to place an image as background of root view of a View Controller i.e. the image should fill the whole screen. The 1x image has size:768x1024. This works for Portrait orientations as non-retina resolution of iPad is also 768x1024 in portrait. In Landscape however the image does not fit. I have tried using ScaleToFit but since aspect ratio of image is not preserved I can not use ScaleToFit