Table View Not scrolling to the last row? - iphone

I am making an iPhone App.
I have used table view in some View Controller.
In iPhone it is scrolling Ok.
I have converted the app to the iPad and autoresized the table view via IB and changed the size of CELL.
It is not showing me the last cell and giving me a jerky feel so I could not select it.
I don not know where I am going wrong?

Actually It is a problem of resizing autoresizing.
In my case
Table view is showing the correct result now.
You can see below tabe view I have used Image view, so by autoresizing property (IB) some part of the table hides below the Imageview because of extra stretching.
Otherwise table view is working perfectly well.s

Related

ios - Overlapping table views and scrolling

I am writing a simple iphone app. I have:
- A search bar at the top
- A table view below that
I've got another table view which gets displayed under the search bar once the user starts typing, showing suggestions for what they might mean. When shown this table view overlaps with the main table view mentioned above.
The problem I have is that I cant scroll the table view showing suggestions. When I try to it scrolls the table view it's overlapping instead.
Any thoughts on how to make the suggestions table view scroll? I could be doing something silly - I'm very new to iphone programming.
Thanks!
The problem seems to be that I was adding the table view holding the suggestions to the search bar, adding it to the search bar's parent seems to have fixed it. I.e:
[[searchBar superview] addSubview:tableView];
I assume the logic is that I can only receive touch events that overlap with my views parent area.

Content changes when using autolayout

In xib table is having 1 rows
Dynamically as the app progresses in table from code there are 3 rows.
In table view I have button in cell on whole click I need to show one pop up view and set its frame according to cell frame
On the click I set frame of that pop up view
As soon as the pop up view's frame is set the view is seen as it is seen in xib
that is now instead of 3 rows there is only 1 row as in xib
These all happens when I set auto layout to true
If I set auto layout false there is no problem
 I am not writing code as there is no code except I set frame with CGRECT
got it
in viewDidLoad I wrote
self.tblTemp.translatesAutoresizingMaskIntoConstraints = YES;
so now my table does not change frame.
In the scenario above I used autolayout in the view as I used the constraints for other controls, but I did not want to use for these particular table.
I did not use any constraints for table view, as I needed to change its frame dynamically.
so I put the above line
Previously table was automatically changing the frame to the one set in xib, on changing any particular frame(I need to show or hide pop up view on some cell button click, so I just set frame there)
I think here apple is translating my auto resizing constraints to auto layout ones. I am not still not sure how it is working. I read some where in apple guidelines about translatesAutoresizingMaskIntoConstraints, as actually by default it is YES.
If anyone finds useful

Shrink UITableView to accommodate another small UIView

I have a UITableView inside of a UIViewController.
I want to shrink the length of the table view dynamically in the code so that when I click on a row, a view slide down from below and covers a small part of the view form bottom.
Using core animation I am able to slide a UIView from below on top of the table view but I want to resize the table view so that the new UIView that slides from below does not obscure any of the rows in the table view.
I tried changing the height of the frame of the table view but its not working.
Any ideas what am I missing here or what are the common ways to do it?
Thanks
Simply setting the correct frame on your table view should work :-)

UITableView covering up other elements?

I'm writing my first iphone app and through several examples I've got a UITableView which is displaying some records from an sqlite db. I placed the element through IB and then had to set it's height inside of my view controller, in the viewDidLoad method:
self.tableView.frame = CGRectMake(0,150,320,300);
While the positioning appears to be working properly, a text field, button and label I originally had on the page are now being covered by a white area. Am I not positioning this table properly?
They're all within the same view - do I need to use multiple views?
Here is what the running app looks like: http://tinypic.com/r/2n7qj35/5
Here is what the IB view looks like: (before the table was ever added, the text/button stuff showed up just fine): http://tinypic.com/r/1491kw4/5
You'll need to resize the tableView or move the other objects ( a text field, button and label ) around to accommodate the tableView.

UITableView Won't Scroll In Certain Conditions

My app has a set of categories. A category can have sub-categories.
DirectoryCategoryController is the first screen, displaying all the top-level categories. Works great. When you tap a cell, if the category selected has sub-categories, I instantiate a new instance of DirectoryCategoryController and push it to display the sub-categories. From there, you tap a sub-category and see the contents.
The problem is that while the top level works fine, when I tap in and see the sub-categories, the table view won't scroll. The search bar takes touches, the table cells take touches but up and down scrolling does not work, like the table view is vertically frozen in space.
If I tap the search bar and hit cancel or if I go into a sub-categories contents and then hit back, the very same table view that didn't scroll works just fine.
Also, if the table view has more items than fit on the screen (about anything bigger than 8 in this layout), everything works.
Very odd problem ; kinda blowing my mind. Any insight?
So, I figured this out and thought I would answer as a reference.
At this point, I think it may be an iPhone OS bug and I'm filing a RADAR.
A UIScrollView, of which UITableView is a subclass, will not attempt to scroll if everything fits on one screen.
In my case, it appears the scroll view thought everything fit (it was very close) but it didn't. Actually, if you removed the UISearchBar from the UITableView, everything would have fit and it wouldn't need to scroll. My guess is that it's incorrectly determining the geometry when the UISearchBar is attached.
Anyway, the work-around was to add this:
[self.tableView setAlwaysBounceVertical:YES];
The odd thing was that when another view was pushed and then popped, the vertical bounce worked fine, furthering my suspicions it's an iPhone bug.
I noticed the same thing when using A UITableView with a UISearchBar as the header view, as configured in Interface Builder in Xcode 4.3.1. In my viewDidLoadMethod, I added the following code and it fixed the problem for me:
self.contactsTable.bounces = YES;
I believe that it's a bug that disables the bounces property, but it can be fixed by re-enabling it.