uiimageview

Reset UIScrollView to new frame dimensions after orientation change

陌路散爱 提交于 2019-12-11 23:57:28
问题 I have an ImageZoom class that subclasses UIView and is a delgate for the UIScrollView. It's pretty straight forward. The class contains a UIScrollView which contains a UIImageView. When an instance of the class is added to a view controller the image is zoomed so that it is flush with the view. There is a method that zooms in when you double tap and zooms out when repeated. Everything works great except for when I change orientation to landscape. I can't seem to figure out how to get the

Check UIImageView array frame equality with NSTimer

大憨熊 提交于 2019-12-11 23:46:44
问题 I am wondering how to check if all the frames of two UIImageView NSMutableArray s are equal to each other. Now I am using a NSTimer for that. Here is the code which I used in the method: __block BOOL equal = YES; [Img1Array enumerateObjectsUsingBlock:^(UIImageView *ImageView1, NSUInteger idx, BOOL *stop) { UIImageView *ImageView2 = Img2Array[idx]; if (!CGRectEqualToRect(ImageView1.frame, ImageView2.frame)) { *stop = YES; equal = NO; } }]; if (equal) { NSLog(@"ALL THE FRAMES ARE EQUAL");

How to display a scrollview of images in fullscreen?

假装没事ソ 提交于 2019-12-11 23:22:44
问题 I implemented a method to display a fullscreen image with a black background. I would like to adapt it for a scrollview of images. The user should be able to scroll and go to next images when it is in fullscreen mode. How can I do this? This is the code to display an UIImageView in fullscreen. It is working. - (void)setUserPictImageViewZoomed:(BOOL)zoom animated:(BOOL)animated { UIView *blackView = [self.view viewWithTag:128]; BOOL isZoomed = blackView != nil; // if our current state

How to Clone A UIImageView

倖福魔咒の 提交于 2019-12-11 22:37:48
问题 I have a UIImageView and I want to make a copy of it and place it somewhere on the screen. How do I do this? I currently only know how to copy and paste the image manually and make a separate IBOutlet for each one, but this is very inefficient because I want to make a game that generates obstacles (UIImageViews) forever so I can't do it the manual way. 回答1: You want to make sure you match all of the properties up as well, like size, clipping, image aspect, opacity, etc. CGPoint

Cannot programmatically show image in UIImageView (iPhone)

断了今生、忘了曾经 提交于 2019-12-11 22:19:49
问题 I'm developing a iPhone app, but I ran into a snag. NSString *fileLocation = [[NSBundle mainBundle] pathForResource:@"happy.1" ofType:@"jpg"]; UIImage *new_image = [UIImage imageWithContentsOfFile:fileLocation]; [self setImage:new_image]; if (new_image == nil) { NSLog(@"can't load image happy.1.jpg"); } bgImageView.image = image; That's the code I'm using to show an image, but it doesn't appear! new_image isn't nil, which I understand it would be if it couldn't load the image. bgImageView is

UIViewImage push to new UIViewController IN STORYBOARD

丶灬走出姿态 提交于 2019-12-11 20:53:48
问题 From questions like this and this, I know how to have a UIViewImage push to a new UIViewController programatically. But how can I do this in completely in Storyboard ? I like Storyboard and would like to not have multiple xib files everywhere. I've already enable User Interaction through Storyboard , but I still can't create a transition... 回答1: Drag UIViewController object onto your Storyboard canvas Select that ViewController and in the top menu bar, click Editor > Embed in > Navigation

Using UIImageView together with constraints

独自空忆成欢 提交于 2019-12-11 20:42:19
问题 I've a UIImageView that holds a profile image in my app. The aspect is "Aspect Fit". But I have some problems. I've pinned a contraint from the UIImageView to the larger UImageView above and with the leading space to superView. but it looks like this on runtime: Way too big and placed wrongly. It also looks like this in IB: What should I be doing to achieve the right behaviour here? Thanks! Erik 回答1: You image view is resizing itself based on the image you set it to display. This behaviour

sliders slow down and don't move smoothly

北城以北 提交于 2019-12-11 19:37:09
问题 I'm doing an application "Photo Editor". I'm beginner in swift. I have a problem with my sliders. They don't work as I need. May be someone know, how I can resolve this problem? Sliders don't work correctly and I need help with it. I don't know, why it's work like that. import UIKit class ViewControllerFilters: UIViewController { @IBOutlet weak var imageView: UIImageView! var image: UIImage? = nil var filter = CIFilter(name: "CISepiaTone") var filteredImage: CIImage? = nil @IBOutlet weak var

IOS Random Images

房东的猫 提交于 2019-12-11 19:29:53
问题 I'm trying to have a random image display when the view loads. I can get an image to display but its not random, it comes up as the position of the %. For example, this code displays the 4th image all the time. Here is my code. { [super viewDidLoad]; int randomImages = rand() % 4; switch (randomImages) { case 0: _imageView.image = [UIImage imageNamed:@"1.png"]; break; case 1: _imageView.image = [UIImage imageNamed:@"2.png"]; break; case 2: _imageView.image = [UIImage imageNamed:@"3.png"];

iPhone: Expand UITextView when scrolling

允我心安 提交于 2019-12-11 19:25:01
问题 in my iPhone Application I have a UIImageView on the top and a UITextView below that. I want the UITextView to expand to the upper site and cover the UIImageView once the User starts scrolling. A similar effect can be found in the Rdio Application. There you can view the cover on the top and the upcoming title below, once the user starts to scroll, the upcoming titles view expands and covers the cover. How can that be done? Thanks. 回答1: Try to use one of the delegate methods of UIScrollView