UITableView not scrolling to the bottom - iphone

I have a UITableView (on a UIViewController) on which I want to ad an iAd banner on the top, but below a toolBar I already have on the top. I'm trying to shift the the tableView (in reference to the view) so I can locate the banner in the space left blank.
To check it ou, I create an action in which I shift the tableView frame:
-(IBAction)iAdAction:(id)sender{
self.tableViewConc.frame=CGRectMake(0, 94, 320, 367);}
where 94 is the summ of 44 from the toolbar and the 50 from the banner.
The action works correctly but then, I cannot scroll to the bottom of the tableView, when I try it, it bounces back. I've tried to change the height of the tableView in the same action ( 430 instead of 367, for instance) but it doesn't work. I've also tried it on IB, but it doesn't work either.
I feel that I'm missing something but I cannot remember what.
Any help?
Thanks in advance!

Not being able to scroll to the bottom of the tableview is usually a symptom of its height being too large. (i.e. it's cut off at the bottom)
Don't compute the height you need and put those numbers in your code. Just find out what it should be from the view hierarchy. For example, you might compute the height of your table view with CGRectGetHeight(self.view.bounds) - CGRectGetMaxY(self.iAdView), and the view's y origin with CGRectGetMaxY(self.iAdView) assuming that the iAd view and your table view are both subviews of self.view. Or, even better, just use autoresize masks or autolayout to keep the table view the right size.

You can try
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 44, 0);

I just had this embarrassing scenario where my UITableView would "bounce" but it wouldn't scroll to the bottom. For ME, the problem was that I was dynamically setting the row heights, and my very last cell was getting calculated with a cell height of -115 (yes, negative). Once I fixed that to return a positive number, my scrolling worked just fine.

Even we can achieve the same in storyboard.
Select tableView --> from the storyboard control click on 'add Missing constraints'. That will add the constraint to tableView and View.
That helped me to resolve this issue. Screenshot_Link

Check the number of the row that you can't see.
After in your viewDidLoad, add this method:
myTableView.contentInset = UIEdgeInsets(top: 0,left: 0,bottom: yourCellHeight * rowHeight,right: 0)
I hope I have been helpful

Related

Stop cell from being dragged out of UITableView bounds

I have a UIVIew on which I loaded a UITableView as subview. The tableView is exactly the height of all it's rows(4 of them) heights sumised, about half the height of the main view.
The problem is that when I drag a row to move it I am able to drag beyond the bounds of the table and this cuts my cell's view (I am only able to see the part that is still in the table's bounds).
Is there a property I can change to stop the cell from being dragable out of the table's bounds?
you can do this like below..
[yourtableview setBounces:NO];
let me know it is working or not!!!!
Happy Coding!!!
If the UITableView is exactly the height of the 4 rows . Then you Do Not Need the Scrolling functionality of the UITableView and you can simply stop the scrolling by :-
TableView.scrollEnabled = NO;
Hope this is what you wanted . Please tell otherwise.

UITableView scrollIndicator position incorrect

So I have a UITableView. Its dataSource is an NSArray of custom objects beeing loaded after a search. When I scroll to bottom, everything works fine, the scrollIndicator scrolls to bottom as desired.
Now when I scroll back to top the scrollIndicator stops about 50pixel below my UINavigationbar.
I have no idea why this behaviour occurs only in this tableViewController, since my UITabBarController consists of 5 UITableViewcontrollers each inheriting from the same super class.
Any help is appreciated, thanks in advance :)
EDIT:
Putting the following code in viewWillAppear:
self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, 0, 0);
Solved the issue. Although I still don't know why this issue only occurs in one of the five tableViewControllers...
It looks like you might have set the scrollIndicatorInsets property of the scroll view wrongly. It might be the same for both bottom and top. Set it so that that you only have the margin for bottom.
i.e
use UIEdgeInsetMake( <top> , <left>,<bottom>,<right>); for this. i.e for your case
yourScrollView.scrollIndicatorInsets = UIEdgeInsetMake(0, 0,bottomInset,0); //Here bottom inset would be the value you have right now .
As UITableView's superclass is UIScrollView, its better to set UIScrollView's scrollIndicatorInsets property to required position.

iPhone how to implement a "Wide" UITableViewCell?

I'd like to have a UITableView with cells wider than 320 points. The user should be able to scroll sideways to be able to view different parts of a UITableViewCell. Is this kind of behavior possible with a UITableView, or should I go and try to implement a tiling UIScrollView?
I tried wrapping a UITableView within a UIScrollView, and the results are terrible - they compete for the scroll gestures and most of the time the scroll view wins, preventing the table from being traversed vertically.
Any input is appreciated!
Thank you!
Update: I tried the proposed solution and it scrolls properly, but the tableview is still only 320 pixels wide. Is tableView's width linked to the window bounds ?
Wrapping the table view with the scroll view is the right way.
UIScrollView with
Show horizontal scrollers
scrolling enabled
autosize to full screen
Inside that, a UITableView
shows vertical scrollers
scrolling enabled
Then I set the table view's frame, with w, being the calculated width of the table view with all columns, whatever your width, and kTableScrollViewHeight being the fixed height of both the table view and the scroll view, in my case, for example 367 points (screen minus status, navbar and tabbar):
tv.frame = CGRectMake(0, 0, w, kTableScrollViewHeight);
and the scroll view's content size
scrollView.contentSize = CGSizeMake(w, kTableScrollViewHeight);
If you want the scroll-to-top behavior when the user taps the status bar, you might want to set
scrollView.scrollsToTop = NO;
because otherwise the scroll view will take away the tap from the table view.

View table size and positioning won't change

I have a xib tableview controller and i can't get the size of the table view to shrink so that i may add additional things before the view(I would like to add some buttons). I try changing the frame in viewdidload and viewwillappear but nothing seams so work. I am using
self.tableView.frame = CGRectMake(0, 100, 320, 200);
but the view remains in place(just under the navigation bar). What am I doing wrong?
Why dont you resize in the xib tableView itself? What's preventing you to do that?
EDIT: Why cant you change the height in xib or x and y coordinates? Attaches image should help you do this easily in IB - (make sure to select your tableView and open the right hand sidebar to get this menu. Once right sidebar opens goto - Size Inspector & here you can do this.
I had the same problem and i realized that my tableView was inside another TableView with its own x and y (so probably i was not able to change it). So you have to make sure that your TableView is a subview of your view or is your main view
Use a UIViewController, drag and drop a UITableView in it, resize as per your wish and there you've got what you were looking for.

UITableView manual scrolling to the last row

I have a table view controller which doesn't let me manually scroll to the last row. It automatically scrolls slightly up so I could never select the last 2-3 rows. Anyone experienced this problem? Should I set a minimum height for the table view to solve this? If so how?
Are you able to scroll using touches to the last row? It may be a contentSize issue.
The first answer in the following post helped me fix this issue -
-[UITableView scrollToRowAtIndexPath:] scrolls, but goes back to 1st row
The initial CGSize for the UiTableView was set at a higher value (beyond the view bounds) and that was the issue. I upvoted that answer. Thanks.
Likely your tableView frame is too big and extends off the screen. This will prevent the bottom cells from being able to scroll up to the screen because they've reached the bottom of the tableView.
You will have to determine the visible area on your screen. But the code should look something like this:
self.tableView.frame = CGRectMake(0.0, 0.0, 320, 324);
Here's the meanings of the CGRectMake values: (X, Y, Width, Height)
Use this
tableView = [[UITableView alloc]initWithFrame:CGRectMake(0,50,320,320)style:UITableViewStylePlain];
Put whatever height as you want.
The easiest way is to set this [statusMessagesTableView setContentInset:UIEdgeInsetsMake(0, 0, 80, 0)];