Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7834611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:15:31+00:00 2026-06-02T13:15:31+00:00

I’m having some problems in my usage of the TiledScrollView from Apple ( 3_Tiling/​Classes/​TiledScrollView.m

  • 0

I’m having some problems in my usage of the TiledScrollView from Apple (3_Tiling/​Classes/​TiledScrollView.m) where sometimes the tiles don’t show as I scroll and other times they do show. To clarify, the problem I’m seeing is analogous to having a tableview list of 100 rows and only 10 rows are being displayed at a time. As you scroll through the list, sometimes one or more rows are blank and stay blank because once they’re displayed on the screen there is no reloading to make sure the content is there. However once these blank rows go off screen and say you scroll back to them, they show up with the content.

It seems to be completely random with no discernible patterns to it’s behaviour. I know the delegate method ((UIView *)tiledScrollView:(TiledScrollView *)tiledScrollView tileForRow:(int)row column:(int)column resolution:(int)resolution) is executing thru NSLog‘s.

My Question is:
1. Have you encountered this phenomenon and how did you solve it? or
2. My debugging skill are very rudimentary. If I wanted to isolate the problem by seeing whether the tile or subviews exists, or the imageView was not able to fetch the image or if its a rendering problem… how would I go about debugging this?

Note- the delegate method shown below is a stripped down version of the above tiledScrollView delegate method where I removed the row and resolution portions of the code since there is no need for it if I’m just scrolling horizontally.

- (UIView *)tiledScrollView:(HorizontalTiledScrollView *)tiledScrollView column:(int)column {
NSLog(@"+++ %s +++", __PRETTY_FUNCTION__);

// re-use a tile rather than creating a new one, if possible
UIView *tile = [tiledScrollView dequeueReusableTile];

if (!tile) {
    // the scroll view will handle setting the tile's frame, so we don't have to worry about it
    if (tiledScrollView == self.timeHour) {
        tile = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, TIMEHOUR_COLUMN_WIDTH, TIMEHOUR_COLUMN_HEIGHT)] autorelease]; 
    } else if (tiledScrollView == self.timeMinute) {
        tile = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, TIMEMINUTE_COLUMN_WIDTH, TIMEMINUTE_COLUMN_HEIGHT)] autorelease];
    }

    // Some of the tiles won't be completely filled, because they're on the right or bottom edge.
    // By default, the image would be stretched to fill the frame of the image view, but we don't
    // want this. Setting the content mode to "top left" ensures that the images around the edge are
    // positioned properly in their tiles. 
    [tile setContentMode:UIViewContentModeTopLeft]; 
}

for(UIView *subview in [tile subviews]) {
    if (subview.tag != 3) {
        [subview removeFromSuperview]; //remove all previous subviews in tile except tile annotation if present
    }
}
UIImageView *imgView = [[UIImageView alloc] init];
UILabel *digitLabel;

// Add blank UIImageView as filler or UIImageView with PNG or UILabel if no PNG sized correctly and offsetted from tile's origin as subviews in the tile
if (tiledScrollView == self.timeHour) {
    if (column < 1) {
        imgView.frame = CGRectZero;
        [tile addSubview:imgView];
        [tile bringSubviewToFront:imgView];
    } else {
        int digitH = ((column - 1) % 12 + 1);
        imgView.frame = CGRectMake(9, 0, 17, 21);
        [imgView setContentMode:UIViewContentModeScaleToFill]; 
        if ((imgView.image = [UIImage imageNamed:[NSString stringWithFormat:@"TimeHour_%02d.png", digitH]])) {
            [tile addSubview:imgView];
            [tile bringSubviewToFront:imgView];
        } else {
//                NSLog(@"No TimeHour_%02d.png", digitH);
            digitLabel = [self makeDigitLabel:digitH frame:imgView.frame fontSize:14.0];
            [tile addSubview:digitLabel];
            [tile bringSubviewToFront:digitLabel];
        }
    }
} else if (tiledScrollView == self.timeMinute) {
//        if (column % 2) {
//            tile.backgroundColor = [UIColor redColor];
//        } else {
//            tile.backgroundColor = [UIColor blueColor];
//        }
    if (column < 1) {
        imgView.frame = CGRectZero;
        [tile addSubview:imgView];
        [tile bringSubviewToFront:imgView];
    } else {
        int digitM = ((column - 1) % 60);
        imgView.frame = CGRectMake(9, 0, 16, 15);
        [imgView setContentMode:UIViewContentModeScaleToFill]; 
        if ((imgView.image = [UIImage imageNamed:[NSString stringWithFormat:@"TimeMinute_%02d.png", digitM]])) {
            [tile addSubview:imgView];
            [tile bringSubviewToFront:imgView];
        } else {
            NSLog(@"No TimeMinute_%02d.png", digitM);
            digitLabel = [self makeDigitLabel:digitM frame:imgView.frame fontSize:12.0];
            [tile addSubview:digitLabel];
            [tile bringSubviewToFront:digitLabel];
        }
    }
}
}
[imgView release];
NSLog(@"Tile: %d",[tile.subviews count]);
return tile;
}

Hope it’s clear.
Thanks for helping,
Hiren

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T13:15:34+00:00Added an answer on June 2, 2026 at 1:15 pm

    I finally solved this!

    The issue wasn’t in the code posted above. It was in the layoutSubviews method of Apple’s TiledScrollView. There is a line of code that calculates the maximum column shown below (max row has a similar calculation)

    int lastNeededCol  = MIN(maxCol, floorf(CGRectGetMaxX(visibleBounds) / scaledTileWidth));
    

    In my case, this formula calculates one extra column than is needed and this column tile ends up sitting off screen. This is fine when you’re not scrolling around and setting animated to NO. But when you do scroll around and/or set animated to YES in scrollview setContentOffset method call, you will sometimes end up with a missing tile because of the delay due to animation or if you scrolled really slowly. The animation or moving really slowly causes the scrollview to detect there is a movement and thus calls the layoutSubviews method where a line of code checks to see which tiles are visible and drops non-visible tiles. Now if you did this just right, then the extra tile created earlier gets dropped because its still off-screen and is never created again until the tile has moved far enough off-screen triggering a reload of that tile.

    The fix I did was to change the above line to:

    int lastNeededCol  = MIN(maxCol, floorf((CGRectGetMaxX(visibleBounds)-0.1) / scaledTileWidth));
    

    This new formula calculates the right number of columns of tiles needed to be displayed on screen thereby eliminating the whole thing of dropping extra tiles sitting off-screen.

    I create an example code on github that helps demonstrates this.
    https://github.com/hmistry/TiledScrollViewDebug

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.