Position of UIImageView in storyboard issue - ios

I have placed UIImageView in storyboard view. At the center position. I am not using autolayout.
When I run the app. The UIimage origin is set at position (0,0) by default.
I need to position it where I set it in storyboard. It is getting updated automatically.
Please help me to solve the issue?
Thanks

I'm not sure, if I understood your problem right... but if the UIImageView isn't positioned at the location you'd expected, you should check your autoresizing constraints in storyboard.

Related

UIImageView view can't be pinned to edge of screen

I pinned a UIImageView to 0 in all four directions, but it stays the same and doesn't pin to the edges, how do I fix this?
I bet it has something to do with your content mode of the UIImageView. Try changing it in your storyboard or in code and find a style that suits your need.
I think you can to resolve it by Using Reset to suggested constraints Easily.How about dragging UIImageView edges to main UI edges and then reset to suggested constraints?

Autolayout UILabel inside a UIView

I have a UIView and inside that there is a subview which is UIView again, inside that UIView i want to add a UILabel at the centre , I am using Autolayout. I have added all the constraints to all the views , but UILabel at the centre is only visible on iPad screens, it goes missing on smaller screen, my doubt is, when its coordinates, when are calculated on resized parent UIView, turns out to be wrong or it gets squeezed so much that it becomes invisible.
Please help me on this, I am not an expert in auto layout so obvious.
Thanks
Also the outer UIView will be presented fullscreen in parent ViewController
These are my constraints
And this is my Layout in all screens
Where your label is centered and also the Black View is increasing height with aspect ratio as per the device's height
set leading,trailing,horizontal center in container and top constrain to label with it's container view.
You should align it horizontally in the container.and also no one will be able to help unless you show all the constraints.

UIScrollView inside UIPageViewController overlapping. Bug or not?

I have UIViewController that contains UIPageViewController that contains UIScrollView.
- UIViewController
- UIPageViewController
- UIScrollView
-UIView (purple)
-UIView (orange)
And there is a problem. When I try to leaf page but not completely (staying on the same page) , there is overlapping of pages. Just look at this:
On the right. It a part from right page!
GitHub project:
https://github.com/maratsarbasov/Bug-or-not-XCode-6.1.1-
It is pretty simple (I specifically created it to show it to you). Please download it and compile.
Is there any way to get rid of this?
Thank you!
PS. Xcode 6.1.1. iOS 8.1 simulator. Using Auto Layout.
The problem is that your leading and trailing and top constraint of the scrollview are relative to the margin.
Uncheck relative to margin and set their constant to 0 this will fix your problem.
let me know if that works out.
Was having a similar problem but in my case it was because I was using 'Aspect Fill' in an image view. If you're doing that make sure you tick the 'clip subviews' checkbox to prevent the imageview breaking out of the page bounds
set clipsToBounds to true in your content view

Origin of UIView doesn't change according to constrains

I've a problem that I can't solve because I'm missing a little detail to explain the following situation.
I've an UIView with a Vertical Space Constraint to be on the bottom on the screen.
On a 3.5", the origin of my UIView is (0,447).
On a 4", the origin is the same but on the simulator's screen the UIView is at the good position (bottom).
I need this origin to put correctly my view according to the keyboard below.
It's important to note that this origin (0,447) is the origin I can read on Xcode thanks to Interface Builder.
I'm catching this origin on the viewDidLoad method.
basicOriginCommentView = commentView.frame.origin;
I've join a screenshot of my Interface Builder.
Thank you for your help.
I tried different ways to solve this problem.
On Interface Builder, I manually increase the y to be perfectly align with the bottom for the 4" device. It was working perfectly for a 4" but I have the same problem for the 3.5".
Finally I saved the origin far after the viewDidLoad method.
Just when my keyboard will appear, I save the position of the contentView. At this time the origin is the good one.
That means I have no idea why the origin was not good when I saved the origin on the viewDidLoad method.
Anyway, problem solved.

UIImageView clipping just some subviews

I have an UIImageView with content mode Aspect Fill and it's clipping its subviews.
Now I want to add a button as subview and it should protrude at the edges about 20px.
The problem is that the option "clip subview" in interface builder cuts the subviews (as expected).
Is there a possibility to get what I want? Any ideas? Thanks, with kind regards, Julian
Just in case anyone else stumbles across this as I did. I found my solution to be setting clipsToBounds on the image view to FALSE:
[_myImageView addSubview:_myButton];
_myImageView.clipsToBounds = NO;
Now my button overlaps the edges of the image view.
Add the UIButton to the UIImageView's superview and it won't be clipped.

Resources