Flip Animation is not consistant in size between front and back images - iphone

using the same flip animation as in the Elements, I have a view controller flipping two .png files of the same size (640 x 960) Within each image I have drawn a border and have noticed that when I flip the image, the second image gets stretched slightly downward and you no longer see the bottom border.
I've checked my .xib file where I have two views and an imageview inside each view. The imageviews are both the same size and have the same settings. I did notice that in interface builder the size for the layout is 320 X 460. Note that the first view appears in its entirety and as I flip it over and over it continues to appear as it should and the other image is clipped.

It turns out that the first view presented to the window has a heeight of 416 and not 480 as expected. I forgot to account for the added NavBar and the initial view squashed my image to fit in its entirety. I have since set the view size in the back view and am dealing with the smaller image area.

Related

How to resize the UIWebView content size on orientation?

My application has a UIWebView which consists of an UIImageView as its subview, when i change the orientation of the device, the image in UIWebView is not affected and it remains in the same position as before. So is there a way to fix this issue. i want the image to automatically allign to its respective orientation.
How about use "Size Inspector". Set as below, the image view will move to new position.
Can you see what I have done in this picture? I removed all red lines around square so that the view moves to keep ratio of distance to edge of screen.
Have a look on the autoresizingMask which defines how the view behaves if the superviews bounds changes. In Xcode you can do it in the Interface Builder/Size Inspector.

iPhone iOS large UIView gets clipped to 320x460 when displayed. How to prevent?

I have a 850x1100 UIView defined in a storyboard it is 4 times the size of a normal window, and I'm using it as a PDF generation template.
The view is wrapped within a scrollview. Yet when I display the view, its frame gets resized and becomes 320x460, effectively cutting off everything outside the frame.
Does anyone have insight on why my UIView defined in a storyboard as 850x1100 gets its frame reset to 320x460 when displayed on an iPhone?
This frame recalculation is not a bug. The frame of a view represents its position and size relative to the screen coordinates.
The iPhone viewing area is 320x480 and any view that has its frame set to a CGRect larger than the viewing area of the device will become "clipped" and have its frame set back to the viewing area (320x460 viewing area due to the status bar).
Try:
scrollView.contentSize = CGSizeMake(850,1100);
scrollView.clipsToBounds = NO;
pdfView.clipsToBounds = NO;
Are you sure it's not the scrollview whose contentsize is too small? It won't automatically resize based on the content - you have to explicitly set the contentSize of the UIScrollView

UIImageView masks and bottom alignment

I am working on an app that has TableViewCells with varying heights. I am placing a UIImageView into them and each will use the same size image (the same size of the largest cell), however I need to mask the excess in the smaller cells (keeping the bottom, not the top).
To be more specific, I have 3 different cell heights, 112, 104 and 88. The images will all be 112 tall and I want the images to have the tops cut off on the smaller cells. Im pretty sure the answer lies within the bounds, frame and center attributes of a UIImageView, but I cant figure out exactly what I should be doing.
You will need to set the frame of your image view such that the bottom of the image view is aligned with the bottom of your cell.
You will also need to ensure the contentview of you cell is clipping content to its bounds (setClipToBounds to yes).
If I had to do this I would subclass the UITabelViewCell class and implement the layoutSubviews method. In your implementation don't forget to call super first so the content view has the right size (also if you go in editing mode). Then use the content view bounds and place your content accordingly.
When you add the image view to the cell, it should automatically cut off the top part, as long as you have the UIImageView bottom positioned within the frame, it should be what you wanted.

How to get an image taken from the camera to take up the entire screen

I have dragged a UIImageView onto the UIViewController window in storyboard. I used the handles to make it take up the entire window. I set the mode of the UIImageView to "Aspect Fit". My goal is for the picture to take up the entire window when the iPhone is held in the same orientation that the image was taken.
But for some reason there's a little bit of space above and below every image.
Also I have it set up for the navigation bar and status bar to disappear when the user touches the image by using a hidden UIButton. This works okay except that the image shifts down when the navigation and status bars come back into view. The image only shifts down when I have this code:
self.navigationController.navigationBarHidden = YES;
self.navigationController.navigationBarHidden = NO;
which I use to get the navigationBar to redraw itself below the statusbar because sometimes the navigationbar will be drawn underneath the statusbar (this happens when making the navigationbar and statusbar reappear at the same time.)
How can I make my images display full screen without all these quirks?
EDIT:
I think it may have something to do with this:
The camera's aspect ratio is 4:3 and the screen's aspect ratio is 3:2.
So there is simply no way for the camera picture to fill the screen
unless you're willing to crop is to 3:2. To do that, apply an
appropriate scale transform.
is it possible to apply an affinetransform to an image in a uiimageview?
You'll want to set wantsFullScreenLayout to YES on your instance of UIViewController. From the documentation for wantsFullScreenLayout.
When a view controller presents its view, it normally shrinks that
view so that its frame does not overlap the device’s status bar.
Setting this property to YES causes the view controller to size its
view so that it fills the entire screen, including the area under the
status bar. (Of course, for this to happen, the window hosting the
view controller must itself be sized to fill the entire screen,
including the area underneath the status bar.) You would typically set
this property to YES in cases where you have a translucent status bar
and want your view’s content to be visible behind that view.
If this property is YES, the view is not resized in a way that would
cause it to overlap a tab bar but is resized to overlap translucent
toolbars. Regardless of the value of this property, navigation
controllers always allow views to overlap translucent navigation bars.

why is there a margin introduced at the top as I move from iPhone startup image to same image as background on UIView?

why is there a margin introduced as I move from iPhone startup image to same image as background on UIView?
So I have:
image used for background/startup on iPhone, it's size is: 320 x 480
after startup I have a UIView that displays the same image (idea is not to have any difference the user can see when transisiton from start up image to the UIView background image)
the first view is "inside" a UINavigationController, however I set the MenuBar and Toolbar to hidden
There is however blank grey margin introduced at the top of the screen, between the signal strength bar and the top of the background image? The height of this grey margin I wasn't expecting looks to be about the height of the top signal strength bar. So this margin/bar effectively drops the background image downwards...
How can I remove this?
Before (i.e. iPhone startup image):
After (background image of first view):
Your launch image contains an imitation of the status bar. The launch image takes up the whole 320x480, but the background image is placed at the top of the main view which is below the status bar. So you can see the imitation status bar still.
Just decrease the y of the background image view to -20.
found two things required to fix it:
setting the View Mode to "bottom" and
found the imageview was slightly off positioned within the XIB designer itself