iPhone UIImageView not showing in set size - iphone

I have a simple app, straight out of the SDK TabBar template, where I implemented UIImageView outlet set in the AppDelegate UIWindow. I want to display there a static image each time user taps a tabbar item. It works fine (the image is displayed and hidden when it should) with one exception:
I have created the UIImageView in IB and set the size 320x430, so the image does not hide the tabbar. The problem is, UIImageView always shows the size of the window, covering entire screen. Any idea why?

Make sure that you set clipsToBounds to YES.

Related

Adding Background Image to FlowCover

I'm using FlowCover in an app and need to add a background, but inserting a UIImageView and sending to the back in .xib only gives me the background image and buttons and no coverflow animation. I also cannot see where i would programme a
self.backgroundColor = [[UIColor alloc]initWithPatternImage:[UIImage imageNamed:#"bground.png"]];
type thing in the implemetation.
Any clues?
It does appear that you can add an UIImageview to the ViewController's View in the MainWindow.nib:
In the editor dropdown you can send the image to the back. It means that the Flow Cover View MUST NOT be set to Opaque and then will sit on top of the ImageView.

Why do my UIImageviews get resized/dimmed when using UINavigation/UITabbar controller

I have an app with a primary view that has a UITabBarController with 5 tabs. Each tab is a UINavigationController.
In interface builder, I'm customizing the background of each page by dragging a UIImageView and setting it fullscreen. The image I'm setting to the view is 640x960. I am setting it to be Aspect Fill.
However, what I've noticed is that it is not where I would expect it to be. When navigating between by tabs, the image seems to be shifted down from where it should be.
Also, when pushing a new view to the navigation controller, the background of this new view isn't offset in the same way as the tabbar one, and it is also slightly dimmed.
How can I set my UIImageViews on each page to be aspect correct and fill the screen 1:1? Also, how does one disable the dimming when pushing a view to the navigation controller?
Thanks for any tips, and apologies if this is covered in another thread, I couldn't find an answer searching the site.
Assuming that you are using the IB to setup your views, you should select navbar/tabbar options to reflect what will be on the actual page. That should place your image correctly. I would also recommend that you make both a low res and hi res version of your background images -- 320x480 and 640x960. Of course, your size may need to be adjusted (reduced) for the navbar and/or tabbar which will leave less than 960 px of vertical height -- probably more like 920px if you are in portrait mode. Then you add #2x to the base name of the hi res version, this would account for older iPhone screens.
Once you have the image placed correctly, resizing should be unnecessary. You can have the image automatically resize width and height using the little arrows on the layout page -- that's a bit hard to describe. It can also be done in code -- if you still need that I can provide a sample.
Maybe you need to set all AutoresizingMask in order to resize the UIImageView properly on each view. And to main aspect ratio u should use either AspectFill or AspectFit on the contentMode.

how to make a custom viewController with transparent black background?

I'm trying to make a viewController appears like the small one in the middle of the picture :
I tried with the UiAlertView, but it semms not offering this feature.
I found some apps adding buttons and labels, photo in similar viewControllers.
Any idea ?
It's not a view controller - it looks like a view that is added as a subview.
The middle View in the image is not a viewcontroller. It is just a custom UIView made up using images and buttons. You can set the transparency of a UIView using property alpha.
Example
yourview.alpha = 0.5;

How to rotate my view-based app to the new interface orientation?

I have a simple view-based app from that template. It has nothing else in there, only one UIButton.
When the device rotates, I want that button to be re-layoutet in such a way that it fits the width of the screen automatically. It has a margin of 20 points left and right, which should always remain the same.
I am not sure what template you are referring to. But if you are adding the UIButton in Interface Builder, take a look at the inspector. What you would need to do is to make sure your UIButton autosizing struts and springs are properly set. There is a preview button that will show you how the button will be autosized if the view changes.

How to resize UIScrollView on rotation?

For my project I've created an UIScrollView with an UIImage inside. The Scroll View is as big as the window frame (tab bar application). What I want is to resize the UIScrollView again when the user rotates the device. How can I do that?
You could just set the autoresizing mask either in Interface Builder, or through code, depending on which way you created the UIScrollView in the first place.