Hi all,
So I'm taking my first stab at writing an iPad app for a client. It's a port of a fairly boring line of business app that does some basic math, data storage, and provides a map of deliveries. Did I mention that the app itself is boring
. I told my client up front that this is my first stab at this and he was fine with that (and it helps that I massively discounted my rate
).
What isn't boring is trying to be extremely picky about how it works. I've figured out just fine how to a UITableView populated with data and doing multiple selection seems to be straightforward enough that I'm not too worried about it. Not that it's particularly pertinent (or at least I don't think it is), my app is a Tab Based storyboard app that targets the latest version of the iOS SDK.
What I am having trouble with is putting two UITableViews on the same view. The UITableViews should have the same functionality so I could reuse the same controller code but with different data. The problem is I've tried setting the datasource of the table to another class implementing the proper UITableViewDataSource Protocol but the data itself never shows up. In all cases I've made sure to implement the required methods that the protocol specifies.
More specifically here's what I've tried:
1: I've tried calling setDataSource on the table and refreshing the data. I just noticed there's a reloadData method that I haven't tried. I also tried code like:
But I'm guessing that I'm missing something. Perhaps reloadData?
2: I tried modifying the cells themselves by trying to do an (in psudocode)
...but that doesn't work because I'm comparing the address of a TableView to the address of a TableView IBOutlet (or at least that's what I understand from watching the debugger local watch window). My ObjectiveC/Cocoa background is not as strong as I'd like it to be so if there's something I'm missing that will make this work, I'd be hunky dory doing it this way.
3: I tried creating a separate UITableViewController class to handle the DataSource/View logic and added it as an IBOutlet in my main view. The problem is that for the life of me I can't seem to figure out how to connect them and get something meaningful from it.
---
I've googled around for some guides (Dr Dobbs, Cocoa With Love, StackOverflow etc) but I haven't had one that has helped me figure out anything more than just setting my view to a UITableViewController and being limited to just one TableView per page. I could in theory change the program flow so that it functions that way, but for the sake of learning how to do it the right way I'd like to avoid that.
Any help is appreciated.
Thanks,
Max
So I'm taking my first stab at writing an iPad app for a client. It's a port of a fairly boring line of business app that does some basic math, data storage, and provides a map of deliveries. Did I mention that the app itself is boring
What isn't boring is trying to be extremely picky about how it works. I've figured out just fine how to a UITableView populated with data and doing multiple selection seems to be straightforward enough that I'm not too worried about it. Not that it's particularly pertinent (or at least I don't think it is), my app is a Tab Based storyboard app that targets the latest version of the iOS SDK.
What I am having trouble with is putting two UITableViews on the same view. The UITableViews should have the same functionality so I could reuse the same controller code but with different data. The problem is I've tried setting the datasource of the table to another class implementing the proper UITableViewDataSource Protocol but the data itself never shows up. In all cases I've made sure to implement the required methods that the protocol specifies.
More specifically here's what I've tried:
1: I've tried calling setDataSource on the table and refreshing the data. I just noticed there's a reloadData method that I haven't tried. I also tried code like:
Code:
myTVController* Controller = [[myTVController alloc] init]; //
UITableView* TempTV = [[UITableView alloc] init];
[TempTV setDelegate:Controller];
[TempTV setDataSource:Controller];
TView1 = Controller;
But I'm guessing that I'm missing something. Perhaps reloadData?
2: I tried modifying the cells themselves by trying to do an (in psudocode)
Code:
if(sender == TView1IBOutlet){ CellData = DSource1[row] } else { CellData = DSource2[row] }
...but that doesn't work because I'm comparing the address of a TableView to the address of a TableView IBOutlet (or at least that's what I understand from watching the debugger local watch window). My ObjectiveC/Cocoa background is not as strong as I'd like it to be so if there's something I'm missing that will make this work, I'd be hunky dory doing it this way.
3: I tried creating a separate UITableViewController class to handle the DataSource/View logic and added it as an IBOutlet in my main view. The problem is that for the life of me I can't seem to figure out how to connect them and get something meaningful from it.
---
I've googled around for some guides (Dr Dobbs, Cocoa With Love, StackOverflow etc) but I haven't had one that has helped me figure out anything more than just setting my view to a UITableViewController and being limited to just one TableView per page. I could in theory change the program flow so that it functions that way, but for the sake of learning how to do it the right way I'd like to avoid that.
Any help is appreciated.
Thanks,
Max