uitable view controller display a page of blank cells - cocoa-touch

I keep having the problem that my tableview controller always displays a lists of cells and only the first two have any data in them. Is this normal? Is it possible to have a tableview controller display only two cells (that is, the ones that have the data in them)?
In other words, the first two cells say "blah" and "blah2". All the others are blank. I know that the number of sections is 1 and the number of rows in the section is 2. I still get the first two cells displayed correctly and the rest are blank. Is this normal? How can I just display two cells?

it is not the table view controller that displays the cell. it is the table view.
you could add a tableview as subview to a view controlled by a view controller and set it frame with a height that is enough to display both cells.

Another option, set the style of the UITableview to grouped and have only one section. It will display only the number of cells you tell it in the method numberofrows:section.

Related

Get a column info, based on the cell selected in view based table view (OSX)

In a table view (view based (OSX)), is it possible to get the column name based on the the cell selected in the table view.
For example, If in a table view, I click on cell (row 3 col 5), does App UI kit framework or other, has a API that would give information on row/column of the cell clicked.
NOTE: I am aware of cell selection API (isSelected on the view) is already available, but it will not work when cell is in edit mode or if a cell is clicked and a cursor is blinking for edit in that cell. It only gives you boolean value whether or not cell is entirely selected but not the state/mode of cell in edit mode or clicked mode.
In a xib, I have a customised table view and two buttons. one for adding a row and other for searching. Now if i click "Add row" button a row is added to the table view with very first cell in edit mode (here i have used tableView editColumn:withEvent:selection API). Works good till here.
But, when i click search, i need to find which cell is currently selected and based on that perform some actions.
So could you please help me find a solution for it.
NSTableView's clickedRow and clickedColumn properties will probably do the trick.

Separator's cell different height

I have a problem with all my tableview and its separator's cell. Randomly one separator cell (sometimes more than one) is higher than the others and I donĀ“t know why. I tried with setSeparatorColor and also adding a custom view at the end of every cell but is always the same effect. Besides, when I scrolling the tableview this occurs in other cells.
You can see pics related in this album http://imgur.com/a/U3zp4. First pic is my desired situation, second pic is how the view is showed initially and last pic is an example of scrolling.

UICollectionView does not reveal all cells in Simulator

I am not very experienced with UICollectionView and Auto-Layout.
I have a very basic UICollectionView inside a root view. The root view seems to have a Navigation Item.
I created a custom cell which is really a square in proper size to allow 2 such cells per row using the FlowLayout.
There are 8 such cells in the view - it is basically a grid. I have absolutely no constraints on the view.
The collection view occupies the entire size of the root view according to the IB and in the editor, the first cell is placed right under the navigation item which is perfect.
However, when I ran the app in the simulator and scrolled the collectionview all the way to the button, I see only a partial fragment of both cells in the last row. I can see I have scrolled all the way down...
Obviously there seems to be some sort of overflow...but I would have thought uicollectionview would automatically handle the overflow and make all the cells visible?
When I set number of items in IB I can see that the cells in the last row are only partially visible.
Seems like content size of the collection view is not right - that's my guess..
What do I need to do to adjust things in IB so that all of my cells are visible...I do not want to hardcode any values in the code...
Thanks.
Solved. It turns out simulator does not show the entire collection view...the same shows fine on the device... What a headache...

how set table view to show a single row only in ios?

In my application I have table view cells with height of table view. When user scrolls it some times stops in between two cells, that is by showing half a cell,cell separator and half of other cell.
Is there any way by which I can scroll the table, after user rotation to a single cell?
What we want is the table view should scroll to a single row automatically after user scroll.
Use scrollToRowAtIndexPath:atScrollPosition:animated: for scrolling to top cell. And as a UITableView is also UIScrollView so you can do it in UIScrollview's delegate method.
scrollViewDidEndDragging:willDecelerate:

Set a background image for every uitableviewcell in a uitableview

Well, I have a uitableview with 4 cells with content, so there are 4 cells displayed and other 4 cells displayed without content to fit the screen. I want all the cells in my uitableview to have a background image (the same for all). When I change the background of the cell on cellForRowAtIndexPath method only the 4 cells with content get the background image and the other 4 without content are still white. Is there any way I can set the background to all the cells an not only to the cells with content?
You may be able to add the additional four cells as blank cells to your table view. This way, they still look exactly like one of your other cells. An alternative may be to make the cells larger which would make you need to use less "filler" cells.
Hope this helps!
increase the number of rows in the section....
lets say u want 100 cells to get the background image... then the cellforRowAtIndex path will be called for 100 cells and hence will set the background..
Hope it works
Let me Know