Resize a TableView of a TableViewController in Storyboard - ios

I have a UITableviewController created with storyboard. Now i want to change the X and Y coordinates of the table view (specifically i want to put a little bit down the table view). There's an option in storyboard where i can set this parameter or change the tableview size? I can't find it
I've tried looking in the size inspector but it looks like X and Y parameter are disabled.

The tableview of UITableViewController is main view so we cannot adjust it in storyboard . If u want adjust size try this. In your UITableViewController .
- (void)viewDidAppear:(BOOL)animated
{
[self.tableView setFrame:CGRectMake(x, y, width, height)];
}
It is viewDidAppear not viewWillAppear

I recommend you to drag a UIView to the UITableView. This will create a panel where you can add components and will make the UITableView go down. however, the UIView will also scroll down along with the table cells.
Another option is to create a UIViewController. Drag into it a UITableView. In this way, the tableview is fully resizable.

Create a UIViewController with a Container View. Link the UITableViewController to the container. Now you can resize the table view by resizing the container.

Related

How to add a custom view to top of tableView in UIViewController and be able to scroll together

I'm trying to put a big UIImageView on top of a UITableView inside my UIViewController. I read that I should not put a UITableView inside a UIScrollView and so I'm trying to find out how to best approach this.
Right now, in my UIViewController what I have is a huge UIImageView (covering half of screen) and below that I have my UITableView.
The problem is that the scroll only works for the UITableViewCell, but I cannot scroll up so that the image goes to the top and invisible...
Thanks for the help!
Make the tableview the height of the view controller's view then in viewDidLoad say something like:
self.imageView.removeFromSuperView()
self.tableView.tableHeaderView = self.imageView
If you're using auto layout you should move the second line to viewsDidLayoutSubviews

How do I add a footer to a UITableView using Storyboard?

Same as this question, only the proposed solution doesn't work for me. When I drag a view to the bottom area of a tableView, it tries to add it to the list of cells higher up:
I'm sure I'm missing something simple... I'm new to storyboards.
EDIT:
Maybe it is adding a "footer" (though, it doesn't label it as such), it's just not adding it low enough. I was ultimately hoping to add an item that would appear at the bottom of the screen (and stick to the bottom of the screen).
TIP: You can use the Tree view (outline view) on the left to arrange the Views (and sub views). I have done a lot of storyboard editing, and dropping things into table views rarely go to the correct hierarchy level in the tree view.
Create a New UIViewController
Insert a UITableView
Resize the tableview by dragging its dimensions
The attached picture has a UITableView on TOP of a UIViewController's UIView. Make sure that you set the delegates in the UIViewController's .m, assign the tableView as a property of the view controller, and then set the tableview's delegate property to the UIViewController object. i.e.: tableView.delegate = self or [tableView setDelegate:self]; also with datasource.
OR you can just click the tableView, on story board, and then drag its delegate and datasource property to THE UIVIEWCONTROLLER! not the view! You can do this by dragging it to the this highlighted part of the view controller's toolbar on the storyboard:
Either you can create a footer view programatically or you can load a view from UIView outlet
UIView *tempFooter=[[UIView alloc]initWithFrame:self.Footerview.frame];
[tempFooter addSubview:self.Footerview];
self.ItemDetailsTable.tableFooterView=tempFooter;
self.Footerview //View outlet
You need to set all the needed constraints of the self.Footerview to get the required layout of the footer view.But you don't need to set constraints for tableview footer itself.

Add UIScrollView to UIViewController

I am trying to add a UIScrollView to an existing UIViewController (with navigation and tab bar) using storyboard and autolayout but I don't get this to work. Up to now I have added all components to the controller by dragging them on it. Now I try to group them in a UIView, so that I can make this UIView a subview of UIScrollView. When I drag my existing components as a subview of my newly created UIView the position of it is wrong. So I must manually correct all positions. Afterwards the compoents are 64px below their old position.
I just cant get it to work. Is there a tutorial or something how to add an UIScrollView to an existing storyboard?
This is the easiest way to learn how to control a UIScrollViewer within a Storyboard.
http://agilewarrior.wordpress.com/2012/05/18/uiscrollview-examples/
You might want to deselect Ajust Scroll View Insets in interface builder.
You can also set in your viewDidLoad :
self.automaticallyAdjustsScrollViewInsets = NO;

Reduce size of TableView in UITableViewController

I'm showing a splitview within a tabbar app. In every split view, master is a UITableViewController (with Freeform size). My Custom tabBar is 1024 x 80 px (always landscape mode), and I'd like to reduce (80-49) px from master & detail that my custom tabbar is hiding from both.
I tried everything, IB, programmatically, in viewWillAppear, with initWithStyle, initWithNib, viewDidLoad, AutoResizing = NO, setbounds, setframe, contentSize... and nothing can make my UITableView to be reduced 31 px!
The UITableView has custom grouped cells, and a backgroundimage. Could be the image the problem?
Any ideas of how can I reduce the size of my UITableView? It has to be the outlet view of File's owner in that viewcontroller? I don't what else to think/do...
Many many thanks in advance, I need to finish this ASAP and that has become a real trouble.
Thanks guys!
I ran into this problem as well. I dont think it is possible with the UITableViewController. I ended up having to create my own subclass of UIViewController with a UITableView as a subview of the viewController's main view. This way you can modify the placement and height within your viewController. One thing to note, if you go this route, make sure to send the tableview the flashScrollIndicators method so that it simulates the behavior of the UITableViewController.
Good luck
I think you should try to set size in viewDidAppear. like i did
(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.tableView setFrame:CGRectMake(self.tableView.frame.origin.x, self.tableView.frame.origin.y, self.tableView.frame.size.width, self.tableView.frame.size.height - 50)];
}

iPhone + resize 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.

Resources