Question

When I add some icons (50) to the TTLauncherView Three20 view, TTLauncherView is always in the last page of the pages of icons. How can I change it to always show the first page of icons instead of the last one? Thanks.

Update

in the viewDidLoad method, I call this one:

- (void)loadIcons
{
int first=0;
TTLauncherItem *firstIcon;
for (NSString *nombre in nombres) {
    TTLauncherItem *icono=[self generarIcono:nombre];
    [launcherView addItem:icono animated:YES];
    if(first==0)
        firstIcon=icono;
    first=1;
}

[self.view addSubview:launcherView];

if (firstIcon!=nil) {
    [launcherView scrollToItem:firstIcon animated:NO];
}
}
Was it helpful?

Solution

You are adding all the items animated. I don't think that is what you want during viewDidLoad and on the other hand, this is what keeps your code from working like you expected. You are adding items animated and then request an immediate (not animated) move to the fist items. That clashes. The simplest thing to do is to add the items without animation [launcherView addItem:icono animated:NO];

But that is not the way you would normally add a lot of items to the launcher. It creates a lot of overhead. There's a pages property, that is better suited for your needs. Look a the TTCatalog example app for code.

OTHER TIPS

After adding your icons juste call [launcherView scrollToItem:item1 animated:NO]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top