uiimageview

Memory consumption while loading a large image in uiimageview in

纵然是瞬间 提交于 2019-12-06 21:01:32
I am loading a UIImage of size 2480 × 3508 into UIImageView using UIViewContentModeScaleAspectFit. I am getting memory warning while loading this image. And after i loaded a few images of this size in this UIImageView the application crashes. Is there any method to solve this. Solution to this problem consists of either loading scaled version of the image (*1) or you have option to display it in full resolution with help of CATiledLayer(*2). [UIImage imageWithCGImage:scale:orientation:]; CATiledLayer example Addendum: If your image source is Photo Library, ALASSet provides already scaled image

Image is showing on simulator but not on a real iPhone

℡╲_俬逩灬. 提交于 2019-12-06 19:42:47
问题 So I got this piece of code, I want to show a picture on my view: imgLogo = [[UIImageView alloc] init]; [imgLogo setFrame:CGRectMake(60, 200, 200, 200)]; [imgLogo setImage:[UIImage imageNamed:@"MyFrigginAwesomeLogo"]]; [self.view addSubview:imgLogo]; But the problem is that it works correctly when testing it on the simulator(iOS 7) but it doesn't show anything on my iPhone(4S with iOS7) itself. 回答1: Answer added from Comment: The iOS devices are case sensitive, but the simulator is not. Make

Spin bottle with UIGestureRecognizer

荒凉一梦 提交于 2019-12-06 19:37:05
问题 I am using this code now to spin bottle on button tap: @IBAction func spinButton(sender: AnyObject) { let rotateView = CABasicAnimation() let randonAngle = arc4random_uniform(360) + 720 rotateView.fromValue = 0 rotateView.toValue = Float(randonAngle) * Float(M_PI) / 180.0 rotateView.duration = 3 rotateView.delegate = self rotateView.repeatCount = 0 rotateView.removedOnCompletion = false rotateView.fillMode = kCAFillModeForwards rotateView.timingFunction = CAMediaTimingFunction(name:

landscape mode images in a full screen UIImageView

我只是一个虾纸丫 提交于 2019-12-06 18:50:25
Is it possible to let the UIImageView handle landscape images differently from portrait images? I'll try to explain, I have ImageViewController with a UIImageView that fill the entire screen. In some point the user launch a UIImagePickerController and choose a picture from the camera roll. Then I create an instance of the ImageViewController with that picture and push it - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; ImageViewController *ivc = [

Issue in UITextField add inside UIImageView in iPhone?

半腔热情 提交于 2019-12-06 16:46:21
问题 Currently i am working in iPhone app, Using UIImageView to set a background image on the screen, then add UITextField inside the UIImageView, then i run the app, the UITextField cannot enabled, How to enable this? please help me Thanks in Advance I tried this: UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)]; imageView.image=[UIImage imageNamed:@"2ndscreenback.png"]; Daystext =[[UITextField alloc]initWithFrame:CGRectMake(57, 122, 171, 31)]; Daystext

Get UIImageView using Afnetworking and put it in an array

旧巷老猫 提交于 2019-12-06 16:46:07
问题 As the title says, i need to get the image and put it in an array. UIImageView *myImage = [[UIImageView alloc] init]; [myImage setImageWithURL:[NSURL URLWithString:@"http://host.com/images/1/1.png"] placeholderImage:[UIImage imageNamed:@"page3.png"]]; [items addObject:myImage]; the problem is that while the image is being loaded, the code continues and nothing gets put in the array, actually I guess an empty UIImageView gets inserted. How do I go about fixing this? On a side note I am using

Rescale image so width is half the size of screen

折月煮酒 提交于 2019-12-06 16:20:58
I'm fairly new to swift and I'm currently trying to display multiple image views within a custom UITableCell. Ideally, I would like to have each image be scaled so that its width fills half of the screen size (while preserving the original aspect ratio). The idea is that each UITableCell will have a collage of 3 images and some additional information in a UILabel -- the tallest image would sit in its own column with the smaller two stacked right next to the tallest. Below is a screenshot to help illustrate what I'm trying to achieve: However, I'm having some trouble with this. Currently, once

Trying to crop my UIImage to a 1:1 aspect ratio (square) but it keeps enlarging the image causing it to be blurry. Why?

江枫思渺然 提交于 2019-12-06 15:58:58
问题 Given a UIImage, I'm trying to make it into a square. Just chop some of the largest dimension off to make it 1:1 in aspect ratio. UIImage *pic = [UIImage imageNamed:@"pic"]; CGFloat originalWidth = pic.size.width; CGFloat originalHeight = pic.size.height; float smallestDimension = fminf(originalWidth, originalHeight); CGRect square = CGRectMake(0, 0, smallestDimension, smallestDimension); CGImageRef imageRef = CGImageCreateWithImageInRect([pic CGImage], square); UIImage *squareImage =

UIImageView not updating image

痞子三分冷 提交于 2019-12-06 15:46:46
I am trying to make a simple "Profile" view that allows the user to change his picture. the image picker loads the gallery successfully and i choose the new image then write it to documents directory to load it in next launch, the problem is the imageview is not refreshing with the new image until i exit the app and relaunch again (only viewDidLoad works but viewWillAppear is loading the old image although it is overwritten!) any ideas? import UIKit class Profile: UIViewController,UIImagePickerControllerDelegate,UINavigationControllerDelegate { var imagePicker:UIImagePickerController

UIImageView rotation animation in the touched direction

倖福魔咒の 提交于 2019-12-06 15:18:52
问题 I have one UIImageView having an image of an arrow. When user taps on the UIView this arrow should point to the direction of the tap maintaing its position it should just change the transform. I have implemented following code. But it not working as expected. I have added a screenshot. In this screenshot when i touch the point upper left the arrow direction should be as shown.But it is not happening so. -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch=[[event