Welcome, Guest
Username Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: TableView Troubles

TableView Troubles 1 year, 5 months ago #1

Hello, I'm having some real troubles using the STV for my needs.

All of your samples and videos have you showing how to edit cells and the data in the table. I don't need to do that at all. All I need to do is load an xml file and display the data in a tableview and be able to select items to show their detail info. I don't want to edit any of the detail information. But I need to lay out the detail view in a custom way depending on the data i'm getting in the xml file.

Also, I have a tab bar that I want viewable on any screen of the tableview. My table view is in one of the screens of one of the tabs but when i click through my STV it animates the tabbar out. That is not ideal.

It would be very helpful if you had a video/sample that loaded an rss feed and displayed its contents in an appropriate manner. Do you have anything like this? Also, is STV capable of doing what I am wanting?

Thanks.
  • Kinoli
  • OFFLINE
  • Fresh Boarder
  • Posts: 17
  • Karma: 0

Re: TableView Troubles 1 year, 5 months ago #2

Hi Jesse,


I'm having some real troubles using the STV for my needs.


Don't worry about it, I'll show you how STV can easily tackle all your requirements. You'll also get the hang of it real soon


All I need to do is load an xml file and display the data in a tableview and be able to select items to show their detail info.


What you're describing seems like an ideal use of STV's key-binding method. With key-binding, you assign your data to specific keys in your model's "modelKeyValues" dictionary, bind your cells to these keys, and then have STV automatically display the data. You can also use the new STV 2.0 beta (official release to be announced in a couple of weeks!) to create custom cells that display whatever data you want in labels that you can arrange in Interface Builder, and have them automatically bind to your data. I can give you detailed code samples if you share with me a bit of how your data is structured.


Also, I have a tab bar that I want viewable on any screen of the tableview. My table view is in one of the screens of one of the tabs but when i click through my STV it animates the tabbar out. That is not ideal.


All you need to do to disable this behavior is set your section/cell "detailViewHidesBottomBar" property to FALSE.


It would be very helpful if you had a video/sample that loaded an rss feed and displayed its contents in an appropriate manner.


You're definitely right.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: TableView Troubles 1 year, 5 months ago #3

Thanks for getting back to me Tarek, I will try out the key binding and see what I can come up with. I have one other question. Is there a way to launch a webview when you click on one of the cells in the table? Thanks a lot.
  • Kinoli
  • OFFLINE
  • Fresh Boarder
  • Posts: 17
  • Karma: 0

Re: TableView Troubles 1 year, 5 months ago #4


I will try out the key binding and see what I can come up with.


Great. Please make sure you call [tableModel reloadBoundValues] after you set the dictionary keys, or whenever you manually change the key values.


Is there a way to launch a webview when you click on one of the cells in the table?


Sure, just implement the SCTableViewModelDelegate method called "tableViewModel:didSelectRowAtIndexPath:" and do whatever you want there.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: TableView Troubles 1 year, 5 months ago #5

I'm just having a tough time wrapping my head around this. Here is what I'm after. I just want to display content for the end user. They don't need to edit anything. I don't like using interface builder because its limiting when you don't know exactly what data you will receive from your xml doc. The content would look something like this...

North
- Company 1
-- Name: Company 1
-- Address: 001 Wisteria Lane
-- Logo Image: logo.png
- Company 2
-- Name: Company 2
-- Address: 002 Wisteria Lane
- Company 3
-- Name: Company 3
-- Logo Image: logo.png
South
- Company 4
-- Name: Company 4
-- Address: 234 Another Street.
-- Logo Image: logo.png
- Company 5
-- Name: Company 5
-- Logo Image: logo.png

So essentially the first view of the table would only list North and South, the second view after tapping either one of those would list the companies associated with it. If you click on a company you will see its Name, Address, Logo if they exist.

What I'm asking for seems pretty simple and common but I have seen no examples even close to what I'm asking for. Is this an easy thing to do with STV and if so would you have any examples you could give me that might help me achieve something like this? Thank you.
  • Kinoli
  • OFFLINE
  • Fresh Boarder
  • Posts: 17
  • Karma: 0

Re: TableView Troubles 1 year, 5 months ago #6

Hi again Jesse,

I've created a sample application for you that does exactly what you want, please find it attached to this post (since this forum is public domain, I naturally omitted all STV files, so please add them to the "Sensible TableView" folder inside the application folder).

Following is an overview of how the sample application functions:

After seeing your data structure, it became very clear to me that STV's object-binding method is the way to go. I've used object-binding instead of key-binding because your data structure is hierarchical, and I wanted STV to generate all the detail views for me automatically based on the object hierarchy. I basically created two objects that reflect your data structure, Area & Company:

 
@interface Area : NSObject
{
NSString *name;
NSMutableArray *companies;
}
 
@property (nonatomic, copy) NSString *name;
@property (nonatomic, readonly) NSMutableArray *companies;
 
@end
 
 
@interface Company : NSObject
{
NSString *name;
NSString *address;
UIImage *logo;
}
 
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *address;
@property (nonatomic, retain) UIImage *logo;
 
@end
 


The rest was really easy. I just created a class definition for Company and another one for Area, then created an NSMutableArray called areasArray that should be loaded with areas from your xml file. I finally added an SCArrayOfObjectsSection to STV representing the areasArray, and STV took everything else from there.

Please tell me if you have any questions, I'd love to hear your feedback. This attachment is hidden for guests. Please log in or register to see it.
Attachments:
  • Attachment This attachment is hidden for guests. Please log in or register to see it.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
Last Edit: 1 year, 5 months ago by tarekskr.
  • Page:
  • 1
  • 2
Time to create page: 0.98 seconds