Cannot freeze the table header while scrolling the rows? [duplicate] - iphone

This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Some Gap remains between Table Top and Table Header only when table loads and scrolled down to the last row?
I am using Xcode.
self.mytable.tableheaderview=label;
By this code I can get the header but I can not freeze it...plz help

The best thing to do is create a UIViewController which is a UITableViewDelegate and UITableViewDataSource, and have a UILabel at the top of the UIViewController's nib, and a UITableView underneath the UILabel. This will have the effect of having the UILabel staying put in its position, with the UITableView still able to scroll like normal. Hope that Helps!

This question sounds a like one I just answered here. All you should have to do is set yourTable.bounces = NO; in your viewDidLoad function. Either that or uncheck the "Bounces" option in the NIB if you used Interface Builder to layout your table.

What do you mean by freezing? If what you think is to stop it from scrolling while scrolling the rows of the table, I don't think its possible. See the table header is part of the table view and is designed to scroll along with the rows. If you just want a header that is static, dont make it a table header. Just add a view or label separately and place it above the table view. The table view will then scroll below that.

Related

Search bar displaying beneath table - swift storyboard

Seems like a pretty basic issue, but I have a tableViewController and at the top of the screen I've got a collection, beneath this I want to include a Search Bar. But for some reason it won't let me place this above the Table View Cell. It will let me add it into the collection view bizarrely but it goes behind the cells.
Is this a limitation caused by the fact I've included a Collection at the top of the screen? Is there only space for one element above a table on a tableViewController? Is there a workaround whilst still using a tableViewController?
Likely a noob question, but I'm still v noob
Is there only space for one element above a table on a
tableViewController?
Correct.
You get one header view area, and one footer view area for the tableViewController as a whole. (plus extras for the sections)
If you want a quick solution for a simple table then the tableViewController saves you about 60 seconds. - but if you want to do something more complex now or later, then you may want to consider using a regular UIViewController, dropping a UITableView into it and applying constraints as needed.
You would also need to remember to set the tableView dataSource and delegate up and comply to their protocols - or you go the diffableDataSource route.
Thanks #agentoverflow I couldn't find any documentation that explained the limitations of a UITableViewController.
Came up with my own solution. Put a view into the header area and put my collectionView and searchBar into that. Hooked the code up for both elements and both are working as expected.

UIImageView and UItextView inside TableView

I'm working on iOS RSS app, and my last view, which is a UIViewController, is similar to the attached image. I inserted in my DetailView.xib, one Image View to pass the images of the RSS feeds and two Text View to pass the title and summary respectively.
The question is, how can i make the same, but inside a UITableview?
you can use custom cells for it and can add this custom cell at particular index. At first index you just add image view and at second index you just add textview.
Check out this pretty good tutorial Custom UITableViewCell Using Interface Builder.
i hope it helps you.
You can achieve this particular thing by using Custom Table View Cell.
Table View gets created using single Table View Cell again and again. It is much more efficient and uses less memory.
You should check this tutorial.
I hope it will help you.
Thanks
You can make TableView height UITableView.automaticDimension and make sure UITextView autoscroll is disabled and constraint should be leading, trailing, bottom and top.
Here's the link this might work for you:
How to make a UITextView Expand with the text like the Notes app

Is it possible to put one UITableView over another UITableView in InterfaceBuilder?

I know I can use codes to add UITableView one by one.
[self.view addSubview:tableview1];//
[self.view addSubview:tableview2];//
I hope to do the same thing in InterfaceBuilder, when I drag one UITableView onto another one, the new one always pushes the old one to the bottom, rather than just stays over the old one of UITableView.
Welcome any comment
Thanks
If you have a parent view that will contain your tableviews then you shouldn't have any problem. If you're trying to place them directly in a window then I could see a problem. If things aren't lining up the way you want you can always change their position via the Size Inspector or by nudging them with the arrow keys (shift-arrow key moves in 10 pixel increments).
Why anyone would want a tableview on top of another tableview escapes me.
Your parent view should be a subclass of uiviewcontroller and your xib should have the root view as a uiview and not uitableview.
I used two overlapping table views to show two different contents on the same view, which could be toggles using a segment switch. Apparently my client requirements were vague enough that I couldn't just filter out data like how the phone app displays all calls/missed calls list.

How i hide the header and footer of UITableView Controller?

I develop an application in which i selected the UITableView (only two row) having group style on the UIViewController with background image. But i want to be only those two row of the group table shold be displayed on the background image, and the header and footer of the table must be hide.
How i do that?
alt text http://file:///Users/Nikhilesh/Desktop/image.png
EDIT2 - OK, now I think that what you really want is to make the background of the table view transparent so that your background image is visible. This is answered in another question on SO, give that answer a try. These questions here and here explain how to use your own image for the background of the table view.

Problem in UITableView and UIScrollView

My table has more than 10 rows with 50 row height....so i can't select my last row....so i have set UIScrollView and add this table into UIScrollView.
Table display perfectly but which rows are displayed in UIScrollView, these are not selectable.
How can i get this row selecablt in UIScrollView. If anyone body know then pls tell me wha to do?
Thanks,
Haresh.
Putting a UITableView inside a UIScrollView won't work, beause UITableView is a UIScrollView. You're going to have to work out why UITableView won't scroll properly for you on its own.
Check how you initialize it and look at some of Apple's example UITableView code to see what is different.
It may be that your navigation bar, toolbar or some other control is hiding that last row. Check to make sure the tableview partly under another control.