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

  • SEARCH
  • Home
  • 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 5929051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:22:13+00:00 2026-05-22T14:22:13+00:00

Issue Description The following code results in load method of TTModel not being called.

  • 0

Issue

Description

The following code results in load method of TTModel not being called. I’ve stepped it through the debugger, as well as stepping through the TTCatalog application. The only difference between the two that I can see, is that when the catalog sets it’s DataSource in the createModel method of the controller, TTModel’s load method gets called, whereas mine does not.

About the Code

I’ve commented the specific areas of code, to tell what they should be doing and what problem is happening, but I included all of it for completion’s sake.

You should look at specifically

  • PositionsController’s createModel method
  • PositionsList’s load method

Those are the areas where the issue is, and would be the best place to start.


Code

PositionsController : TTTableViewController

- (id)initWIthNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if (self)
    {
        self.title = @"Positions";
        self.variableHeightRows = NO;
        self.navigationBarTintColor = [UIColor colorWithHexString:@"1F455E"];
    }

    return self;
}

//This method here should result in a call to the PositionsList load method
- (void)createModel
{
    PositionsDataSource *ds = [[PositionsDataSource alloc] init];
    self.dataSource = ds;
    [ds release];
}

- (void)loadView
{
    [super loadView];
    self.view = [[[UIView alloc] initWithFrame:TTApplicationFrame()] autorelease];
    self.tableView = [[[UITableView alloc] initWithFrame:TTApplicationFrame() style:UITableViewStylePlain] autorelease];
    self.tableView.backgroundColor = [UIColor colorWithHexString:@"E2E7ED"];
    self.tableView.separatorColor = [UIColor whiteColor];
    self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    //self.tableView.delegate = self;
    [self.view addSubview:self.tableView];
}

//Override UITableViewDelegate creation method, so we can add drag to refresh
- (id<TTTableViewDelegate>) createDelegate {

    TTTableViewDragRefreshDelegate *delegate = [[TTTableViewDragRefreshDelegate alloc] initWithController:self];

    return [delegate autorelease];
}

PositionsDataSource : TTListDataSource

@implementation PositionsDataSource

@synthesize positionsList = _positionsList;

-(id)init
{
    if (self = [super init]) 
    {
        _positionsList = [[PositionsList alloc] init];
        self.model = _positionsList;
    }
    return self;
}

-(void)dealloc
{
    TT_RELEASE_SAFELY(_positionsList);
    [super dealloc];
}

-(void)tableViewDidLoadModel:(UITableView*)tableView
{
    self.items = [NSMutableArray array];
}

-(id<TTModel>)model
{
    return _positionsList;
}
@end

PositionsList : NSObject <TTModel>

@implementation PositionsList

//============================================================
//NSObject

- (id)init
{
    if (self = [super init])
    {
        _delegates = nil;
        loaded = NO;
        client = [[Client alloc] init];
    }
    return self;
}

- (void)dealloc
{
    TT_RELEASE_SAFELY(_delegates);
    [client dealloc];
    [super dealloc];
}

//==============================================================
//TTModel

- (NSMutableArray*)delegates
{
    if (!_delegates)
    {
        _delegates = TTCreateNonRetainingArray();
    } 
    return _delegates;
}

-(BOOL)isLoadingMore
{
    return NO;
}

-(BOOL)isOutdated
{
    return NO;
}

-(BOOL)isLoaded
{
    return loaded;
}

-(BOOL)isEmpty
{
    //return !_positions.count;
    return NO;
}

-(BOOL)isLoading
{
    return YES;
}

-(void)cancel
{
}

//This method is never called, why is that?
-(void)load:(TTURLRequestCachePolicy)cachePolicy more:(BOOL)more
{
    //This method is not getting called
    //When the PositionsController calls self.datasource, load should be called,
    //however it isn't.
    [_delegates perform:@selector(modelDidStartLoad:) withObject:self];
    [client writeToServer:self dataToSend:@""];
}

-(void)invalidate:(BOOL)erase
{
}

@end
  • 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-05-22T14:22:14+00:00Added an answer on May 22, 2026 at 2:22 pm

    Short answer: return NO instead of YES for isLoading in your PositionList.

    For a longer explanation:

    If you dig through the Three20 source, you’ll find that setting the dataSource on a view controller sets the model, refreshing the model and potentially calling load. Here is the code called when the TTModelViewController refreshes:

    - (void)refresh {
      _flags.isViewInvalid = YES;
      _flags.isModelDidRefreshInvalid = YES;
    
      BOOL loading = self.model.isLoading;
      BOOL loaded = self.model.isLoaded;
      if (!loading && !loaded && [self shouldLoad]) {
        [self.model load:TTURLRequestCachePolicyDefault more:NO];
    
      } else if (!loading && loaded && [self shouldReload]) {
        [self.model load:TTURLRequestCachePolicyNetwork more:NO];
    
      } else if (!loading && [self shouldLoadMore]) {
        [self.model load:TTURLRequestCachePolicyDefault more:YES];
    
      } else {
        _flags.isModelDidLoadInvalid = YES;
        if (_isViewAppearing) {
          [self updateView];
        }
      }
    }
    

    Your PositionList object is returning YES for isLoading and NO for isLoaded. This means that Three20 thinks your model is loading when it isn’t. You may also need to implement shouldLoad if it doesn’t return YES by default.

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

Sidebar

Related Questions

I got the following code: <table border=1> <tbody> <tr> <td>issue</td> <td><a class=issueDrawer href=#>view</a></td> <td>description</td>
My issue is not able to render the chart in .tpl file. The following
I have the following vba code is part of a larger script. The issue
Description: Following code piece is used in Android/iPhone for Roundabout carousal. Each LI is
I have an issue parsing an XML feed - The following code attempts to
Our issue is that our project has files being downloaded using wget to the
I am using following code to convert string to sha1 string but i am
Problem Description: Occassionally when debugging, I get the following error. I'm using visual studio
Problem description If I make a non-modal window as a child window through setting
In my object ' handler ' I have the following code: Product tempProduct; //

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.