Xib not scaling on iPhone 6 - objective-c

I have designed a xib whose configuration I have set as shown in the pic
I have added a UIImageView to the xib view and added proper constraints
So that the UIImageView appears full screen but the problem is that this works good for iPhone 5 but fails to scale on iPhone 6, I am not understanding the problem.
The UIImageView Configurations are as in the pic

To fill the UIImageView full screen, set the mode to Scale to fill. If it does not fill screen yet, then the size of image is not appropriate. i would recommend you to use vector graphics.

I was making a silly mistake while adding the UIView as subview I was not describing the frame
Describing the frame as,
[self.profileView setFrame:CGRectMake(0, 0, Get_Bounds.width, Get_Bounds.height - 64)];
This does the trick.

Related

How to prevent UISegmentedControl from scaling segment images on iOS 7

I have an UISegmentedControl with 100x42 bounds. I've set up three segments with 26x26 images and 4x42 divider images. The three segment images should fit in the segments, but they are scaled and for the worse they seem to fit vertically and are only scaled down horizontally, thus loosing proportions.
This problem appeared after i changed to Xcode 5 and iOS 7 SDK. Before that the segment images were displayed with correct proportions and in original size.
I'm not using interface builder. I've tried to set the segment sizes manually and setting the segmented control's contentMode to UIViewContentModeScaleAspectFill without help.
Is there any way to force the UISegmentedControl to simply render the images as they are?
You may set auto layout constraints to correctly define UISegmentedControl frame. Like this
I know this is a late answer but I have the same issue testing an app for IOS 7.1.
If you set the image in the code it's working properly. Example:
- (void)viewDidLoad {
[super viewDidLoad];
[_segmentedControl setImage:[UIImage imageNamed:#"779-users-toolbar"] forSegmentAtIndex:0];
}
In my project I have the normal image, and the #2x & #3x versions of the image.
I tested the code in 7.1, xcode 6.1.
When I run it in 8.1 the image set via IB works properly as well, so this may be a bug in 7.1 that has been fixed in 8.

iOS 7 view background

I have settings View which is a View Object under self.view.
I added the background image as: self.settingsView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"settings_bg__650x740.png"]];
The problem is, it is having extra images at the bottom. This only happens in iOS 7.
Here's the screenshot:
Please, help me to solve.
The image is being tiled. Why are you creating a tiled image and using it as a background color? Just put the image in a UIImageView and add the image view to the view.
try resize your image before adding to background.
You can find answer in here
Stretching a image in iOS using colorWithPatternImage
the settings view's bound size is higher than the background color referred image. so, the image will tile to fill the settings view.

Can a UIViewImage draw its image outside its frame?

When making a photo viewer app found that our UIImageView controller is drawing its image outside its frame when the content mode is different neither ScaleToFill nor Aspect Fit.
Trying to understand why; I isolated the problem making a new project which only has a UIImageView with the following frame (50,50,100,100). The image size contained in it is (4592,3056).
After running the app, with the content mode set to ScaleToFill and AspectFit it all worked as expected:
But after setting the contentMode of the UIImageView to TopLeft, the image is drawn outside its frame, the odd thing is that the log from the frame after all has been drawn is still the original {50,50,100,100}.
I've try to understand the issue by moving the Autoresize, the clips and the content mode of the UIViewController but the result is the same.
set clipToBounds = YES on the view.
its NO by default because that makes drawing way cheaper

xcode 4.5, iPhone 5 breaks my UIScrollView

So I've got a pretty complex project. I'm using both interface builder and xcode directly to build objects. Right now I have UIScrollViews being built in IB, where they need to be, and UIButtons built on top of those scrollviews. There are several scrollviews in the same spot, but that really shouldn't make much of a difference.
Anyway, the issue is that it works perfectly on the iPhone 4. But when building on the iPhone 5, it moves the Scrollviews to the bottom of the screen, where before it was x=0, y=361. All my other objects are being placed correctly with some empty space underneath them. I know how to check for iPhone 5:
I don't know how to post code on here with colors and whatnot, they make it super complicated so here is how I'll do the if/then:
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
CGSize result = [[UIScreen mainScreen] bounds].size;
if(result.height == 480){
// iPhone Classic
}
if(result.height == 568){
// iPhone 5
}
}
I don't know of a way to do if/then in IB. I tried just manually changing the location this way:
[peopleScrollView scrollRectToVisible:CGRectMake(0, 449, 320, 58) animated:NO];
That did not work. So, what I'm asking is there a way to change the location of a UIScrollView in the code itself? If there is not, then I think I will have to build all 5 UIScrollViews manually in code, which I definitely do not want to do.
If you select your Scroll View object, then click the Size Inspector module, you will notice the default Autosize Mask is set to: Left, Top.
Depending on your view "Mode" option, and your view's "Resize Subviews Automatically" option, this view and subviews will be shifted down on the 4" screen compared to the 3.5" screen.
Depending on what your particular view should look on each screen is up to you. On my project, I adjust the autosize mask to Left, Top, and Bottom,
as I want my UIScrollView and subviews to remain at the top of the screen (as drawn in IB) on the 3.5" and 4".
You can also set vertical and / or horizontal sizing arrows inside the box in the autosize graphic
. This will attempt to scale object as accordingly for dynamically sized screens.
The Autosize Mask should be your new best friend with iPhone5.
See Xcode Interface Builder. How Do These Autosizing Mask Settings Differ? for more info.

How to get an iphone application to resize correctly on orientation changes?

I have an iphone app, with a view (well multiple but let's say one at a time). The view is very simple just some text-fields and images on there. I have set the auto-resizing attributes for those controls so that they know that they need to be centered no matter what the orientation is. There is no code that moves them or anything, everything is in IB.
The views only re-orient correctly if i change to landscape on the main view and then transition to the other views. If I go to any view on portrait and then try to go to landscape, the iphone performs the animation for rotation, but my controls don't seem to move to the right places. When i test the orientation in IB, it seems to re-orient correctly.
Why does that happen? How can I fix it?
I find I have to set reset the frame of my main view for changing orientation:
CGRect mainViewFrame = CGRectMake(0.0, 0.0, 320, 480);
[self.view setFrame:mainViewFrame];