uiimageview

How to left align UISearchBar placeholder text

时光毁灭记忆、已成空白 提交于 2019-12-18 04:36:32
问题 I need to make a custom search bar like this. The problem I am having is left aligning the placeholder text, as well as placing the search icon in the right. I have a png of the search icon that I have tried to use in an UIImageView , and set that UIImageView as the rightView of the UISearchBar 's UITextField . This solution has not worked, and I ran out of ideas. Does anyone have a solution? 回答1: Don't use a UISearchBar if you need to do these kinds of customizations. You'll have to make

How do I display a progressive JPEG in an UIImageView while it is being downloaded?

我只是一个虾纸丫 提交于 2019-12-18 01:05:13
问题 Downloading an image from the net and showing it in an UIImageView is fairly easy. However, this requires the image to be completely downloaded before it is shown to the user, completely defeating progressive JPEG (and PNG) images. How can I render the partially downloaded images while the transfer is being done? I would imagine the SDK to have some callback function which would update the image, but I can't find such a function. Is it possible at all with the current iOS SDK? 回答1: Did you

Gesture recognizer (swipe) on UIImageView

青春壹個敷衍的年華 提交于 2019-12-17 23:10:00
问题 I am trying to NSLog when I swipe over an UIImageView with this code, but it does not work for some reason. Any idea ? @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; UIImage *image = [UIImage imageNamed:@"image2.png"]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; imageView.frame = [[UIScreen mainScreen] bounds]; [self.view addSubview:imageView]; UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action

How to get image file size in Swift?

ⅰ亾dé卋堺 提交于 2019-12-17 22:34:03
问题 I am using UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIPopoverControllerDelegate these delegates for choosing image from my gallery or my camera. So, how can I get image file size after choosing an image? I want to use this: let filePath = "your path here" var fileSize : UInt64 = 0 do { let attr : NSDictionary? = try NSFileManager.defaultManager().attributesOfItemAtPath(filePath) if let _attr = attr { fileSize = _attr.fileSize(); print(fileSize) } } catch { } but here I

Resize UIImage and change the size of UIImageView

房东的猫 提交于 2019-12-17 22:32:32
问题 I have this UIImageView and I have the values of its max height and max width. What I want to achieve is that I want to take the image (with any aspect ratio and any resolution) and I want it to fit in the borders, so the picture does not exceed them, but it can shrink them as it wants. (marked red in the picture): Right now the image fits the necessary size properly, but I have 2 worries: 1. The UIImageView is not equal the size of the resized image, thus leaving red background (and I don't

How do you make an UIImageView on the storyboard clickable (swift)

杀马特。学长 韩版系。学妹 提交于 2019-12-17 21:55:59
问题 I am new to swift (and Xcode development in general) and I was wondering how to make an ImageView on the storyboard clickable. What I'm trying to do is make it so when its clicked, it shows another view controller. 回答1: You can add tapGesture for that. Here is the code: class ViewController: UIViewController { @IBOutlet weak var imageView: UIImageView! override func viewDidLoad() { super.viewDidLoad() // create tap gesture recognizer let tapGesture = UITapGestureRecognizer(target: self,

Dynamic UIImageView Size Within UITableView

删除回忆录丶 提交于 2019-12-17 21:52:34
问题 I want to implement a TableView with a Custom TableViewCell showing an image. To make this simple, I simply put a UIImageView inside a tableviewcell using autolayout (illustrated below). What I want is to display the image inside a UIImageView however those images dimensions can be anything and are inconsistent (portrait, landscape, square) ... Therefore, I'm looking to display an image with a fixed width (the width of the device) and a dynamic height that respect the ratio of the images. I

Best way to transition between two images in a UIImageView

☆樱花仙子☆ 提交于 2019-12-17 21:51:23
问题 I have implemented a pretty simple picture viewer that will allow the user to browse through a collection of images. They are loaded from the Internet, and displayed on the device through a UIImageView object. Something like this: UIImage *image = [[UIImage alloc] initWithData:imageData]; [img setImage:image]; imageData is an instance of NSData that I use to load the contents of the image from an URL, and img is the UIImageView instance. It all works well, but the new image replaces the one

Downloading PFFile (Image) from Parse append it to array and fill UIImageView with that array (Swift)

女生的网名这么多〃 提交于 2019-12-17 21:08:58
问题 I have a problem with parse and swift and i hope you can help me :) I'm downloading strings and PFfiles from Parse and want to add it to an array (this works fine). Then I want to fill a Label with the string array (works fine as well) and an UIImageView with the PFFile array which is also an Image. But I always get an error: PFFile is not convertible to "UIImage But I have no clue how I can convert this PFFile so that I can use it with the UIImage View. var titles = [String] () var

Xcode Imageview Aspect Fit Remove Extra Space

元气小坏坏 提交于 2019-12-17 20:19:30
问题 I have an imageview inside a UITableViewCell. Imageview with Aspect Fit creates a lot of extra space in the top and bottom if the image is large. The extra space (gray background color) is shown in the picture below. How do I remove the extra space? A few notes: This particular image is 890 x 589 and the screenshot was taken on a iphone 6S simulator. I am using UITableViewAutomaticDimension for automatic table cell height. There is no height constraint on the imageview so it can resize