uiimageview

UIImage created from MTKView results in color/opacity differences

两盒软妹~` 提交于 2019-12-09 06:47:41
问题 When I capture the contents of an MTKView into a UIImage, the resulting image looks qualitatively different, as shown below: The code I use to generate the UIImage is as follows: let kciOptions = [kCIContextWorkingColorSpace: CGColorSpace(name: CGColorSpace.sRGB)!, kCIContextOutputPremultiplied: true, kCIContextUseSoftwareRenderer: false] as [String : Any] let lastDrawableDisplayed = self.currentDrawable! // needed to hold the last drawable presented to screen drawingUIView.image = UIImage

iOS show UIImage full screen with zooming (pinch and double tap) enabled

血红的双手。 提交于 2019-12-09 04:19:42
问题 I have an UIImage captured from the camera with UIImagePickerController . Now after the user clicks on it, I'd like it to show full screen and be able to to zoom it in and out using pinch gestures and also the double tap gesture to zoom in a particular area. In other words, I'd like to emulate what the ios's default image browser does. I display the captured image in an UIImageView with: self.imageView.contentMode = UIViewContentModeScaleAspectFill; which makes the image go full screen. But

iPhone Best practices for large number of animations using UIImageView

自作多情 提交于 2019-12-09 03:56:39
问题 Just requesting a little advice animating images on the iphone. I'm building an app that consists of a character with 5 animations. Each animation consists of roughly 50 images with an average duration of 3 seconds. I was going to create an array of images for each animation, have these as the source for an UIImageView and switch these as needed. But as you can guess this approach kills my iphone's memory and thus the app. (250 images @ 130K each!) So this got me wondering how other people

iOS Swift: How to properly scale down an image?

ぐ巨炮叔叔 提交于 2019-12-09 01:36:23
问题 I'm using AlamofireImage to download and set my UIImage: backdrop.af_setImageWithURL(downloadURL) The image is substantially larger than what I will be displaying and so I have an issue with aliasing. How can I resize this image properly? Results: 回答1: You can resize the image with any size once you have a valid UIImage : func resizedImageWith(image: UIImage, targetSize: CGSize) -> UIImage { let imageSize = image.size let newWidth = targetSize.width / image.size.width let newHeight =

Faster iPhone PNG Animations

家住魔仙堡 提交于 2019-12-09 00:08:40
问题 Currently I have a PNG animation on a timer that is firing every .01 seconds. However, performance isn't optimal and the animation is visibly slow. I have over 2000 images. Is there a better way to accomplish this? I've posted something similar to my approach below. timer_ = [NSTimer scheduledTimerWithTimeInterval:.01 target:self selector:@selector(switchImage) userInfo:nil repeats:YES]; -(void)switchImage { p = [p stringByAppendingFormat:@"/Movie Clipping 1 000%i.png",i]; imageView_.image =

Take Screenshot of a UIImage iOS

橙三吉。 提交于 2019-12-08 21:01:34
I want to take screenshot of a perticular section of my screen in a iOS App. The attached image is that part of screen. Here I want to take screenshot of the red marked rectangular area containing 3 UIImageViews which contains a white Image Frame at background , an image with coffee cup and the apple sign image on the coffee respectively. I am using the following code for doing that... - (UIImage *)captureView:(UIView *)view withArea:(CGRect)screenRect { UIGraphicsBeginImageContext(screenRect.size); CGContextRef ctx = UIGraphicsGetCurrentContext(); [[UIColor blackColor] set]; CGContextFillRect

move a CALayer (add animation)

試著忘記壹切 提交于 2019-12-08 18:16:53
问题 well I have a CALayer layer and I would like to move it, with a CADisplaylink. Like : layer.center=CGPointMake(layer.center.x + 10, layer.center.y + 10); but I can't use center or position for the layer.Here is my problem, I want to make it move like it was a uiimageview. 回答1: To move layer try to use this method -(void)moveLayer:(CALayer*)layer to:(CGPoint)point{ CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; animation.fromValue = [layer valueForKey:@

How to rotate an UIImageView using TouchesMoved

喜夏-厌秋 提交于 2019-12-08 15:18:52
问题 I am trying to rotate an UIImageView using Touch events, I want the image to rotate with my finger, I want to do the same as this: dropbox link (best to see it, so u understand what I mean) After researching on how to rotate an UIImageView: How can I rotate an UIImageView by 20 degrees. I have tried the following code with my simple approach to developing iPhone apps: class ViewController: UIViewController { var startpoint:CGPoint! var endpoint:CGPoint! @IBOutlet var yello:UIImageView

How to make image view round in swift 4

青春壹個敷衍的年華 提交于 2019-12-08 15:02:32
问题 Though there is solution of this question is present in internet, but I am unable to do so, I want to round a image. this code I am using: extension UIImageView { func makeRounded() { let radius = self.frame.width/2.0 self.layer.cornerRadius = radius self.layer.masksToBounds = true } } then i call this function in viewdidload() like imgvw.makeRounded(). but it is not coming. please help the previous link is not helping me 回答1: import UIKit class ViewController: UIViewController { @IBOutlet

create fliping book with images

不问归期 提交于 2019-12-08 14:38:14
问题 I want to create a application in which i required following function create array of images in view and move like page turning effect orientation change then same view will execute. tap on image then zoom in or zoom out image. double tap then upload bigger image from web-services. on image when select part of image then open url of that image. 回答1: Try these Sample code https://github.com/devindoty/iBooks-Flip-Animation http://oleb.net/blog/2010/06/app-store-safe-page-curl-animations/ https: