UIImagePickerController and UIButton background images - objective-c

I can successfully take a photo and set it to the background image for a button. The problem is that the image gets smushed. Should I be setting a crop on it or what am I missing for this to render the image correctly. Thanks.

After properly using constraints in the IB, the image then set to the button in a normal format. I found out that having dotted lines on the view controller due to constraints is a bad thing. After doing constraints the right way, the image showed perfectly. Thanks all for the help.

Related

xcode6 storyboard uibutton image title laybout

how can i set button's image and title correctly position.
now the storyboard preview like:
I add title and image to the button and set title and image edgeinset to get picture layout. but the button'size is changed with the phone size. so i can't set it in storyboard properly for all size.
i want to to know is there a way to deal with this situation?
thanks!
see the tutorial link below ,
http://www.appcoda.com/introduction-auto-layout/
it's show how to fix constant heigh and width of view.
you see clear in image how it done.

iOS 7 + Auto Layout: Strange UIImageView behaviour

I've got a strange UIImageView behaviour:
I've got a UIViewController with an embedded UIImageView and a close button. Very basic stuff, done a thousand times. I didn't use Auto Layout that much in the past, but another view controller in the same Storyboard has nearly the same config and doesn't appear as strange as this specific one.
In my Storyboard the Controller looks like that:
...and on the device it looks like that:
That image is 1024x768, so it should be filled to the bounds. Content mode in the image view is Aspect fill. When i dismiss the view, i can see that the upper part of the image view must be hidden at the top with some negative Y or something.
I need Auto Layout in this storyboard, because it's an iPhone + iPad App with both orientations.
Has someone hat a behaviour like that before?
Thank you!
Edit:
Here is the layout panel:
First, get rid of the alignment constraints, they are not needed if you're already anchoring your view to every side with a set distance.
Second, check the mode property of your UIImageView in the interface builder. If the image was not big enough and you had it set for "TOP" instead of, say, "aspect fill", you'd see something like this even though the view is actually covering the whole screen.
I'm sorry that I have to say this, but it was, as you certainly thought, my own fault.
The problem was that I made a photo with the iPad, and the iPad can be used in both orientations in this app. The photo was taken and was then used for an own view that allows the user to put annotations on the image.
The image gets then saved, and that was were the problem occured: I call
UIGraphicsBeginImageContextWithOptions(self.view.frame.size, NO, 0.0);
The landscape image was now taken into a portrait frame. After adjusting this and only allowing portrait mode, everything worked well.
Thanks anyways for your answers. And sorry for asking a question when the problem was another one and my own fault.

Autolayout is not resizing Uicollectionviewcell items when animating between layouts

I have a uicollectionview cell with an image view inside that I want to resize when I switch to a larger 'zoomed in' layout.
I have placed constraints inside the cell that does resize the image view when the zoomed in layout is displayed. I am using uicollectionview setLayout animated method.
The problem is the image does not scale with animation only the collection view cell does.
The image seems to just jump into its end size with no interpolation. So the animation looks extremely choppy.
It seems as if I need to somehow control the auto layout constraints so they animate with the set layout animated method but I don't know how.
Is there a proper way to scale the cell and it's contents ?
Thanks so much!
I had (have) the same problem with Auto Layout!
Presently the simplest way I've found to deal with it is to set:
imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
This causes the imageView size transition to be animated smoothly and is the only thing that I've found to work consistently with setCollectionViewLayout:animated:
You may find this answer and the linked GitHub demo app I wrote to solve a similar issue helpful.

Load larger image on tap of small image with animation

I'm trying to load a large version of an image in the centre of the user's screen when then tap on a smaller version of the image that's already on my view.
Ideally I want to do this using an animation to get to the new image like a vertical flip.
Also if there's a way to make the background look greyed out like it's not the foreground then that would be even better.
Here's an image of what I'm after, I'm at work at the moment so haven't got access to the actual code / images.
I'm a new user so can't add pictures. Click here if you want to see what I'm thinking.
Image
There is an KGmodal Example Exist in GitHUB hope that Might Help you.
You have to Change the content view and Add an Imageview Programatically (with required size ) in the content View.
Follow the below link: https://github.com/kgn/KGModal
For Fliping the image see the tutorial iphone Flip Image.
In the end I added the larger image on to begin with and set its alpha to 0, then added a gesture recognizer on the smaller image that animated the larger one and gradually changed its alpha to 1. The did the reverse on the large image. Don't know why I didn't think of that in the first place!

UIImage View shifting in Interface Builder

I am using interface builder to create my create my .nib file. THe first thing I did was to add an UIImage view to cover the screen with a background image that serves as part of the interface graphic. Everything was working fine, now the image is shifted up slightly in the simulator. THe Status, Top, and Bottom bar are all "Unspecified". Has anyone encountered this issue and found a way to resolve it?
Is the size of your view in the nib the same size as it will be in the simulator? If it's smaller, your autoresizing masks may be centering it vertically. Verify that it's the correct size, and then verify the autoresizing masks in IB are set the way you want them to be.