UA-17470720-3

Jump to content


Photo
- - - - -

How to use TableModel without a navigator?


  • Please log in to reply
4 replies to this topic

#1 Mario

Mario

    Starting Out

  • STV 2.0
  • Pip
  • 8 posts
Reputation: 0
Neutral

Posted 14 October 2010 - 08:19 PM

Hello there - Fantastic work, the model is really nice.
However I am having trouble to understand how to use the basics in an app that doesn't uses the navigator.

Here's what I have done:
Create an empty app with my own view
Dropped a table on the view via IB
- linked outlets: delegate and tableview to UITable in my code - called tv below.

in the header file
#import "SCTableViewModel.h"
SCTableViewModel *tableViewModel;
IBOutlet UITableView *tv;

In the viewload event I used this code:
tableViewModel = [[SCTableViewModel alloc] initWithTableView:tv withViewController:self];
SCTableViewSection *sec = [SCTableViewSection sectionWithHeaderTitle:@"Hello"];
[tableViewModel addSection:sec];
[sec addCell:[SCTextFieldCell cellWithText:@"Hi there"]];


Problem:
nothing happens. The table view is all gray, default color.

Should I connect something in IB?
Should I set some properties?
What am I missing??

#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 15 October 2010 - 02:59 AM

Everything you're describing seems to be fine. Would you please send your project to our support email so that I can check it and tell you what's wrong? Thanks!

#3 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 15 October 2010 - 11:12 AM

Thanks for sending in your project. You had two problems there:

1- You instantiated SCTableViewModel in the loadView method, while you should always do that in the viewDidLoad method.

2- You haven't created a property for your outlet, which is not recommended as the table view does not get retained that way.

I've fixed these issues and sent you back your project. Please tell me if you're having any more issues. Good luck!

#4 Mario

Mario

    Starting Out

  • STV 2.0
  • Pip
  • 8 posts
Reputation: 0
Neutral

Posted 15 October 2010 - 11:34 AM

the object model is fantastically written and the support is even better.
Excellent and thank you - I was already recommending ST to friends now I am going to add the reference in the about of the app as well!

Thank you,
amok

#5 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 15 October 2010 - 11:36 AM

Thanks a lot amok, that's really kind of you :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users