Tableview in UIView - How to size cell and meaning of shadow - xcode

I added a tableview to a uiview in Storyboard and am having trouble getting the cell to be the right size. It is currently unusually large as a result of my trying to resize the tableview to fit the uiview. Can anyone tell me how to resize the cell (The upper handle is not visible and the dimensions are disabled in size inspector) and also why it the screen has a section in white in the middle...What is the white relative to the grey?

Related

Why is the footer image not aligned to the bottom of the view?

I'm trying to use storyboard and layout constraints to align the footer image to the bottom of the view but when running on device it's hovering high above the bottom. The image is aligned with 0 margin to the superview. The view hierarchy is Controller->View->ScrollView->View->FooterImage. The image is bigger and scaled with content mode set to "aspect fit".
The constraints set on the image is sufficient, but I guess the constraints set on its super View is incorrect.
If you want to display the image at bottom you also need to make it superView align to the bottom of the ScrollView , and the same on ScrollView.
Check my previous answer here : https://stackoverflow.com/a/46539635/8187800 .

In Xcode 6, why is the Image View keep automatically resizing when I try to resize a subview within it?

Posted is a picture of my issue.
I'm fairly new to Xcode and I have a UIImageView object in my View. I added another View (white rectangular box) within the View, and below the UIImageView object.
If I try to resize the inner View in any way using the cursor, the Image View resizes to 0 as shown below. However if I use the Size Inspector (ruler icon) on the right to resize the subview, the Image View stays the same size. What the heck?
Is there some setting I need to adjust? Thanks

Scrollview in Interface Builder with Autolayout with content size dynamically set to screen size?

I want to set the content view of a scrollview to whatever the current screen size is, but AutoLayout is doing some funky stuff. This is trivial in code... just create a scrollview with a frame that is the superview's bounds. Then create a content view with the scrollview bounds and populate it and set the alwaysBounces... properties to YES. In interface builder though, this is some kind of sinful thing it seems.
I know Autolayout handles scrollviews totally differently because it wants to infer the content size based on constraints. My approach that failed is setting the scrollview to have 0 distance to its superview (all sides attached). Then, the same with the content view (the single scrollView subview)- attached to all superview edges. Then the precompiler thing complains about not knowing the content size, so I set a width and height constraint at placeholder to be removed at build time. But the result is a (CGRect){0,0,0,0} contentView. The 0 space to trailing edge and bottom of superview are totally ignored.
So how can I make a scrollview with a dynamic content size based on the screen size?
Bonus points if you can explain how you would do the same, but for a content size of 2x screen width.
You can try setting a constraint for the content view's width to equal the scroll view's width (for your bonus question: with a multiplier of 2). Same for height.
Not sure what the point of having a scroll view whose content is always the size of the scroll view is. By definition it wouldn't scroll, right?

How to pan a zoomed out UIImageView inside an UIScrollView?

I have an UIScrollView which contains one UIImageView. Everything is working correctly, I can zoom in and out, when zoomed in I can pan around, etc.
The problem that I am unable to solve is how to pan a zoomed out image around the screen. The user needs to be able to zoom the image out until it's small, and then move that small image to any point on the screen. Sadly, it's stuck in the center of the screen (usually, it would be stuck in the top left corner but I did fix that problem).
There are a couple of things you need to do here. I suggest doing them in viewWillAppear rather than viewDidLoad because if you're using storyboards, it doesn't work quite right in viewDidLoad.
First, you need to set the content size property of your scroll view to be the size of the photo itself because you want the entire area of your photo to be scrollable.
self.scrollView.contentSize=self.photoShown.size;
photoShown is UIImage. scrollView is a UIScrollView
Second, you need to set the frame of your UIImageView that houses your image to be the size of your image:
self.imageView.frame=CGRectMake(0,0, self.photoShown.size.width, self.photoShown.size.height);
if you haven't done this, then the frame of the UIImageView is the size of the screen itself and there is simply nowhere to pan. That's why it needs to be bigger, so you can pan to the regions not currently shown on screen.

UIScrollView scroll when orientation changes

I create a UIScrollView, in which I put a UIView. Then I add some objects which are subviews of the view I added to the UIScrollView, so that I can zoom properly all the objects within the scroll.
The point is that I have an UIImageView as a subview of the mentioned view, which contains an image which is adapted to the screen size by using "imageView.contentMode = UIViewContentModeScaleAspectFit;" property.
Initially, in portrait orientation, the image fits with the screen width, so you can't scroll to left or right. When I change orientation to landscape, image fits with screen top and bottom. Then my problem. You can scroll up and down a little bit the image, as if it preserved some of the top and bottom padding from the portrait orientation.
But, if I try to zoom out, as the min zoom I setted was 1,0, the image recovers its initial size. Then you can't zoom out anymore when the zoom scale is 1.0. The 'virtual' padding is gone!
It seems as if it needed some kind of refresh.
The same happens when I keep changing orientation for portrait and landscape. It only works correctly when app loads.
I tried setting "myUIScrollView.zoom = 1.0;" in "didRotateFromInterfaceOrientation" method (when the image was not zoomed) and it worked, the 'virtual' padding again was gone.
It seems that it needs a refresh once orientation changes.
Any clue about what I'm doing wrong?

Resources