Resizing UIimages pulled from the Camera also ROTATES the UIimage?

The reason your code doesn’t work is because the imageOrientation on the code that you have is not being taken into account. Specifically, if the imageOrientation is right/left, then you need to both rotate the image and swap width/height. Here is some code to do this: -(UIImage*)imageByScalingToSize:(CGSize)targetSize { UIImage* sourceImage = self; CGFloat targetWidth = … Read more

Gesture recognizer (swipe) on UIImageView

Enable UIImage view user interaction which is disabled by default. [imageView setUserInteractionEnabled:YES]; Adding a Swipe Gesture Events UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; // Setting the swipe direction. [swipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft]; [swipeRight setDirection:UISwipeGestureRecognizerDirectionRight]; // Adding the swipe gesture on image view [imageView addGestureRecognizer:swipeLeft]; [imageView addGestureRecognizer:swipeRight]; Handling Swipe Gesture … Read more

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

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, action: “imageTapped:”) // add it to the image view; imageView.addGestureRecognizer(tapGesture) // make sure imageView can be interacted with by user imageView.userInteractionEnabled … Read more

How to combine/ merge 2 images into 1

You can create graphics context and draw both images in it. You’ll get an image result from both your source images combined. – (UIImage*)imageByCombiningImage:(UIImage*)firstImage withImage:(UIImage*)secondImage { UIImage *image = nil; CGSize newImageSize = CGSizeMake(MAX(firstImage.size.width, secondImage.size.width), MAX(firstImage.size.height, secondImage.size.height)); if (UIGraphicsBeginImageContextWithOptions != NULL) { UIGraphicsBeginImageContextWithOptions(newImageSize, NO, [[UIScreen mainScreen] scale]); } else { UIGraphicsBeginImageContext(newImageSize); } [firstImage drawAtPoint:CGPointMake(roundf((newImageSize.width-firstImage.size.width)/2), roundf((newImageSize.height-firstImage.size.height)/2))]; … Read more

Difference between UIImage and UIImageView

Example: UIImage *bgImage = [UIImage imageNamed:@”Default@2x.png”]; UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:bgImage]; backgroundImageView.frame = [[UIScreen mainScreen] bounds]; UIImage Overview: A UIImage object is a high-level way to display image data. You can create images from files, from Quartz image objects, or from raw image data you receive. The UIImage class also offers several options for … Read more

Text views and image view disappearing from view controller in Xcode 6.1 storyboard

Another workaround is to add constraints to the layout Before resizing of any views. (add missing constraints e.g.). The bug only seems to occur when there are no constraints available. I have reported the bug to Apple with Bugreporter. Edit: So, at least it seems that Apple Bugreporter is working. The problem is fixed in … Read more