While working on practice coding exercises last night, I was trying what I
thought should be a simple project. I wanted to acquire some data, assign it
as the datasource for a UITableView, then select a value in that, pass off the
selected value to a holder of data, then push a new view for another
UITableView, acquire data based on the selected value and then display it.
What bent my mind over a stump was that all the examples I had all never seemed
to follow Apple's documentation in the creation of UITableView. I've got one
empty xib file with a window tied to the App Delegate. As a result, in my
second UITableView, I got a nice empty white screen, until I walked through the
TableView Programming Guide for iOS and added this code:
- (void)loadView
{
NSLog(@"LocationSpecificsViewController");
NSLog(@" In loadView");
UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen
mainScreen] applicationFrame]
style:UITableViewStylePlain];
Now, this is what I expected to have to do if creating the tableView
programatically. But for the life of me, I can't figure out how all the other
examples (that aren't using a storyboard or xib file) are bringing a table into
existence merely through lazy instantiation or with the viewController
declaration in the application didFinishLaunching portion of the AppDelegate.
I'm expecting that I should look for a UITableView alloc somewhere, but well,
that's obviously not the case. Though the TVC is being created in the
AppDelegate, I'm expecting to see a visible declaration of the UITableView, and
am not clear how that's happening through lazy instantiation (in Hegarty's
example) or in some of the sample files that Apple provides that don't use xibs
or storyboards.
What's happening that allows the tableview to appear and operate with only..
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
*)indexPath
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
...yet no visible UITableView allocation that I can see?
TIA
- Alex Zavatone
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]