iPhone + resize UITableView - uitableview

I have a view in which I have UITableView (grouped style). In the Interface builder, I am resizing the UITableView so that it looks like a small portion in center of the screen.
But when I run the application, UITableView takes up the whole area of screen and does not look like the small portion in center of screen (which I had set in Interface builder).
I tried to resize the tableView programmatically in the viewDidLoad method as tableView.frame = CGRectMake (0.0,0.0,100.0,100.0), but still the tableView occupies the whole area of screen.
Please help.
Regards,
Pratik

Sounds like your table view's got autoresized. Try to fiddle with the autoresizing settings.
If your table view is the main view then it will automatically fill the whole view controller's space regardless of the autoresizing settings. In that case, make an empty UIView as the root view and put the UITableView as a subview of it.

Related

Issue with Autolayout and StackView while using ScrollView

I a trying to create a UIScrollView that fits exactly the contents of its subviews. I do this with a StackView and the scroll view's height is determined by how much content there is in the stack view. Within the stack views, there are views that contain an UIImageView and a UITextView
The UIScrollView starts below the title view, however every time I want to add another view (which it should scroll when the content is bigger than the actual frame) there is an issue with the scroll view's Y position. This works perfectly if I only add UILabels and UITextFields, using the same procedure
How can I do it so I can programmatically add views on the stack view that includes an UIImageView and a UITextView, just as the View Controller with labels and textfields does.
You can download my app project at the following url
https://github.com/francisc112/DescriptionWithImageApp.git
Instead of a scroll view why don't you use a table view and create a custom cell with the stackview and its contents inside the cell and you can dequeue the same cell for adding multiple information.
I was not able to open your project
So I Tried opening your StoryBoard and Re-Viewing your constraints Applied , here is what I have Done Please check in following Link
Link - https://drive.google.com/file/d/1D-dzKsSqpx7dWsI5fYRdAfCMY_vENoIR/view?usp=sharing
View Hierarchy
Note - For such output I will prefer using a TableView instead of StackView as Same output can easily be achieved using TableView

iOS UIScrollView with UIWebView and UITableView in Storyboard

I have a complex design to create. I want to have something like this
- UIScrollView
--UILabel
--UILabel
--UIWebView
--UITableView
--UITextField
--UIButton
I am using a Storyboard and I want the ScrollView to take the height of the Full Webview and the TableView so that there is only one parent scrolling and other scrolls are disabled and the whole page seems like one single view.
Right now, the whole UI looks very messed up and only the Webview and table view scroll indivisually and the parent scrollview not scrolling at all making the labels and textfields have a constant place and the button not showing at all.
EDIT
Using raki's solution, I used a TableViewController. I have something like below:
But the webView does not cover its full content and just shows in the area shown in the image.
How can I solve this issue?

Content in UIScrollView is being cutoff early

I have several UIViews within aUIScrollView and I want them to scroll all the way to the bottom of the UIScrollView before cutting off (See Image #2).
Background on the scroll view:
I created the UIScrollView itself is a subclass of a customUIView. I put the view in a UIScrollView so the auto layout in storyboard creates the correct frame for the device.
In the view controller attached to the storyboard UIViewController I created anIBOutlet to theUIView, and in the viewDidAppear function I called a function attached to the view that populated the UIScrollView.
In the storyboard I gave the view a blue background so I could tell its frame. Here is the what the storyboard looks like:
Then this is what it looks like on my phone:
Notice how much space exists between where the view cuts off and where the bottom of the screen is. It does this on all devices.
I have tried adjusting the bottom content inset. It is currently at 0.0 but I tried to make it -20 and that did not help.
How can I fix this?

Advice on how to use a UIScrollView

Hello I have some app (from book) which looks like this:
You can see the image is cropped. I want to have a UIScrollView
which allows to scroll up and also see the whole picture.
This is how my app looks in interface builder.
What do you suggest where should I add ScrollView (as which subview etc.) to achieve what I need? (I guess I will need some intermediary UIView?)
This is what I usually do for fixed contents:
In IB create your view with a UIScrollView at your desired size and position connected to a scrollView outlet.
Also in IB create the view for the contents (bigger than the scroll view). Connect this to a UIView outlet called contentView.
In viewDidLoad do this:
// Put the content view into the scroll view
[self.scrollView addSubview:self.contentView];
self.scrollView.contentSize = self.contentView.bounds.size;
If you want dynamic contents then programatically lay them out in viewWillLayoutSubviews and set the contentSize of the scrollView.
Add the UIScrollView as a direct child of Control, and then put everything else inside the scroll view.
Add UIScrollView as first child of your main View and put all of your controls (UITextView, UILabel,...etc ) as sub view of UIScrollView.
And use UIScrollView property contentSize for set your visible area.
For more information read this tutorial.
You should add the UIScrollView directly under Control, then everything else, besides the toolbar should go into it.
What I usually do in these cases is set the scrollView to the size so all content fits, add the content, then resize the scrollview so it only occupies as much of the screen you want.

Why UITableView on the device smaller than in IB

When I create my UI in IB I can't do it right because UITableView height not equals its height on the device.
I don't understand why?
Example:
http://img35.imageshack.us/i/20110401111017.jpg
This is happening because the view is being resized when it is pushed on the navigation stack. You can fix this several ways. The best thing to do it setup your nib so it matches the displayed size. You can also remove te autoresize flags from the UITableView. Finally you could programmatically resize the view inside of the view controller's viewWillShow:(BOOL)animated.

Resources