Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

IDMah

macrumors 6502
Original poster
May 13, 2011
317
11
Hi all.

I have two tableviews (high local & global score) on a scrollview.

When call the table on it's own would work like a charm.. :
Code:
 [myTable scrollToRowAtIndexPath:indexPath
                       atScrollPosition:UITableViewScrollPositionTop animated:YES];

but now it's on the scrollview, nothing happens. When I sort or try to ScrollToRow. nothing!
but it will update when I add/delete an entry.

Do I have to call scrollToRow from the within the scrollView?

thanks
Ian

ps. I would be cool to trigger a scrollToRow when I switch screens

I guess??? Something in :
Code:
-(void)scrollViewDidScroll:(UIScrollView *)sender
{
 // do the tableview ScrollToRow thang //
}
 
Hi all.

I have two tableviews (high local & global score) on a scrollview.

When call the table on it's own would work like a charm.. :
Code:
 [myTable scrollToRowAtIndexPath:indexPath
                       atScrollPosition:UITableViewScrollPositionTop animated:YES];

but now it's on the scrollview, nothing happens. When I sort or try to ScrollToRow. nothing!
but it will update when I add/delete an entry.

Do I have to call scrollToRow from the within the scrollView?

thanks
Ian

ps. I would be cool to trigger a scrollToRow when I switch screens

I guess??? Something in :
Code:
-(void)scrollViewDidScroll:(UIScrollView *)sender
{
 // do the tableview ScrollToRow thang //
}
i faced similar problem when i used an UITableview in an UIScrollView. The UITableView didnt move when i try to scroll it down or up. i searched over web and saw many people faced the same problem. it was because of Auto Layout. i dont know if u need Auto Layout in your case but in mine i turned off Auto Layout and the UITableView worked.
 
Why do you want to put a tableview inside a scrollview. A tableview already has a scrollview within it.

You mention two tableviews, which way are they arranged?
If vertical why not just have two sections on the same tableview. Which might make more sense as both are displaying score data from what you said so cells could be reused between anyway.

Or are the tables next to each other?

Not sure if it's AutoLayout sounds more like your container scrollview is canceling the swipe guestures so that it never gets passed to the scrollview of the tableview. Just a hunch.
 
table up down scroll left right.

Sorry work getting in the way with work... Hahaa.!!!

I have two vertically scrolling Table views, on a horizontally scrolling paged scrollview.

Since I already created the High Score Table view, I figured I'd just slap another version on a Scrollview and all would be copacetic.

Main problem is that the Tableview isn't getting updated, when I add the user's score. Pretty close to dumping it all and using game Centre. sigh...


Just noticed an warning in this: Assigning to id '<UITableViewDelegate>' from type 'HighScoreViewControl'

Code:
[myHighScoreTable sortUsingDescriptors:
     [NSMutableArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"gameTime" 
                                                            ascending:YES  
                                                             selector:@selector(caseInsensitiveCompare:)]]];

this doesn't give me an error:
Code:
 NSSortDescriptor *hisort = [NSSortDescriptor sortDescriptorWithKey:@"gameTime" 
                                                           ascending:YES  
                                                             selector:@selector(caseInsensitiveCompare:)];
    
    NSMutableArray *sortDescriptors = [NSMutableArray arrayWithObject: hisort];
    
    
    [myHighScoreTable sortUsingDescriptors:sortDescriptors];
but still doesn't work..

I see the inserted HighScore Value but does not seem to update after sort.
Double checked I was doing a sort after insert.. which I do.
Also Doesn't scroll to either.

thanks
Ian
 
Last edited:
Little things

SOLVED:

Ok Here's what I did to fix it.

I changed the XIB to make the Scrollview a little bigger, because I read somewhere if the view on the UIScrollview is bigger than the Scrollview then the view never gets triggered/Updated.

Also changed the sort to sort numerically, not string. So this:
Code:
 NSSortDescriptor *hisort = [NSSortDescriptor sortDescriptorWithKey:@"gameTimeSeconds" 
                                        ascending:YES];

Now everything scrolls and triggers. So for now copasetic, now back to the php, Mysql and other stuff. Less fun stuff.

thanks
Ian
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.