uiimageview

how can I get the scale factor of a UIImageView who's mode is AspectFit?

南楼画角 提交于 2020-01-09 19:14:11
问题 how can I get the scale factor of a UIImageView who's mode is AspectFit? That is, I have a UIImageView with mode AspectFit. The image (square) is scaled to my UIImageView frame which is fine. If I want to get the amount of scale that was used (e.g. 0.78 or whatever) how can I get this directly? I don't want to have to compare say a parent view width to the UIImageView width as the calculation would have to take into account orientation, noting I'm scaling a square image into a rectangular

how can I get the scale factor of a UIImageView who's mode is AspectFit?

随声附和 提交于 2020-01-09 19:13:37
问题 how can I get the scale factor of a UIImageView who's mode is AspectFit? That is, I have a UIImageView with mode AspectFit. The image (square) is scaled to my UIImageView frame which is fine. If I want to get the amount of scale that was used (e.g. 0.78 or whatever) how can I get this directly? I don't want to have to compare say a parent view width to the UIImageView width as the calculation would have to take into account orientation, noting I'm scaling a square image into a rectangular

How to convert an PFFile to an UIImage with swift?

陌路散爱 提交于 2020-01-09 05:35:05
问题 How do i convert an PFFile to an UIImage with swift? In this code, the app is getting the file from parse and now i want it to show on a UIImageView, But i get an error... Here is my code... var ImageArray:UIImage = [UIImage]() var textArray:String = [String]() var query = PFQuery(className:"ClassName") query.findObjectsInBackgroundWithBlock { (objects: [AnyObject]?, error: NSError?) -> Void in if error == nil { if let objects = objects as? [PFObject] { for object in objects { //this works

How to convert an PFFile to an UIImage with swift?

一曲冷凌霜 提交于 2020-01-09 05:34:08
问题 How do i convert an PFFile to an UIImage with swift? In this code, the app is getting the file from parse and now i want it to show on a UIImageView, But i get an error... Here is my code... var ImageArray:UIImage = [UIImage]() var textArray:String = [String]() var query = PFQuery(className:"ClassName") query.findObjectsInBackgroundWithBlock { (objects: [AnyObject]?, error: NSError?) -> Void in if error == nil { if let objects = objects as? [PFObject] { for object in objects { //this works

New Data Not Updating after Unwind Segue Performed

北慕城南 提交于 2020-01-07 04:44:11
问题 I'm relatively new to Swift and am stumbling on this problem that is likely very simple to fix, I just can't figure it out and keep hitting a brick wall. I'm making an app where a user taps an image in a collection view controller and it performs an unwind segue back to the main view controller and updates a uiimageview with the image that the user selected. I got the unwind segue to work but the problem is that the uiimageview is always one image behind (i.e. I select image A, unwind segue

Upload image to server ios

你离开我真会死。 提交于 2020-01-07 03:07:29
问题 What i trying to do is send image and text to my database in post method - (void)uploadpic { NSData *imageData = UIImageJPEGRepresentation(self.imageview.image, 90); // NSString *action=@"tempinsert"; NSString *s=@"54.316130"; NSString *s2=@"9.950930"; NSString *facebook=@"12345"; NSString *cate=@"1"; NSString *action=@"insert"; NSString *note=@"Iiiiiii"; NSString *str=[NSString stringWithFormat:@"my url.php"]; NSString *urlString = [NSString stringWithFormat:@"%@",str]; NSMutableURLRequest

Speed up first UIImageView animation (force cache the images)

蹲街弑〆低调 提交于 2020-01-07 02:50:47
问题 My app consists of an animation of about 25 frames. The animations is triggered by a button, and all is working. However, upon first invoking the animation, there is a few second delay. I am aware that this is because the images need to be cached upon their first run in an animation, and I have ~2mb to be cached. I wish Apple would implement an [ animation prepareToPlay] method for this reason. In the meantime, I'm running the animation within viewDidLoad. This caches the images during the

“Int is not convertible to CGFloat” error when subclassing UIImageView

☆樱花仙子☆ 提交于 2020-01-07 01:19:28
问题 I have a weird bug here. I'm subclassing UIImageView to pass some custom properties to my views. If I don't add an init method to my subclass, everything's fine. But if I do add the init (and I'm required to do so), then when I'm creating the frame view the compiler complains that an Int is not convertible to CGFloat. Le subclass with Le init : class CustomUIImageView : UIImageView { let someParameter : Bool init(someParameter: Bool) { self.someParameter = someParameter println("\

Making an Expanding Scrollview

て烟熏妆下的殇ゞ 提交于 2020-01-06 22:47:32
问题 I'm currently making a drawing application in Swift, but I wanted the page to be able to expand if the user wanted more room. I figured that I would use a UIScrollView to scroll around the canvas, but I wanted it to expand whenever the user went to the edge of the page, and for the UIImageView that I am drawing on to expand with it. Does anyone know how I would go about doing this? Thanks! 回答1: In storyboard, drag a UIView into your UIScrollView then constrain that view to all sides of the

Making an Expanding Scrollview

独自空忆成欢 提交于 2020-01-06 22:46:35
问题 I'm currently making a drawing application in Swift, but I wanted the page to be able to expand if the user wanted more room. I figured that I would use a UIScrollView to scroll around the canvas, but I wanted it to expand whenever the user went to the edge of the page, and for the UIImageView that I am drawing on to expand with it. Does anyone know how I would go about doing this? Thanks! 回答1: In storyboard, drag a UIView into your UIScrollView then constrain that view to all sides of the