Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-21-2011, 10:02 AM   #1 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 5
rjzinger is on a distinguished road
Default Connecting Table View - no outlet?

Hello.

I followed this tut on reading from a DB and populating a Table View, it worked just fine. When I tried to move this into another application "tableView" doesn't appear as an outlet that I can hook my Table View to. Any suggestions?

Tut: iPhone SDK Tutorial: Reading data from a SQLite Database | dBlog.com.au

If you need to see some code, please let me know. I am new to this forum and to coding.

Thanks,
Rich
rjzinger is offline   Reply With Quote
Old 04-21-2011, 10:54 AM   #2 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 1,106
Meredi86 is on a distinguished road
Default

please post the .h file that you are using.

It sounds like one of the two projects is using a UIViewController and the other is using a UITableViewController - after a quick look at the tutorial they areusing a UIViewController for their tableview. If this is the case then you dont need to use IB to place a Tableview on the screen, or to hook it up to an IBOutlet. A UITableViewController takes care of that for you. you can tell from this line in your .h:
Code:
@interface AClass : UITableViewController {
From my own experience and from what i have read around a little it is better to create a UIViewController and then add in the tableview delegates. So that would look like this:
Code:
@interface AClass : UIViewController <UITableViewDelegate, UITableViewDataSource> {
I am not 100% sure on the differences between the two (other than the obvious - one is a tableview and one is just a view) but i have always found it simpler working with a UIViewController and subscribing to the tableview delegate and datasource. The ease of a UIViewController really comes into its own when you want to do more than just display a table on the view.
Meredi86 is offline   Reply With Quote
Old 04-21-2011, 11:13 AM   #3 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 5
rjzinger is on a distinguished road
Default

Meredi86, I figured it out, I was missing the functions to create the DB an read it.

Now, the first table view is populated but when you tap on any of the items, they go nowhere. :-(

Here is the code that should make something happen, correct?

Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic -- create and push a new view controller
	SalesTrainingAppDelegate *appDelegate = (SalesTrainingAppDelegate *)[[UIApplication sharedApplication] delegate];
	Step *step = (Step *)[appDelegate.steps objectAtIndex:indexPath.row];
	
	if(self.stepView == nil) {
		StepViewController *viewController = [[StepViewController alloc] initWithNibName:@"StepViewController" bundle:nil];
		self.stepView = viewController;
		[viewController release];
	}
	
	// Setup the animation
	[self.navigationController pushViewController:self.stepView animated:YES];
	
	// Set the title of the view to the step's name
	self.stepView.title = [step name];
	
	// Set the description field to the steps description
	[self.stepView.stepDescription setText:[step description]];
	
	// Load the steps image into a NSData object and then assign it to the UIImageView
	//NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:[step imageURL]]];
	//UIImage *stepImage = [[UIImage alloc] initWithData:imageData cache:YES];
	//self.stepView.animalImage.image = stepImage;
	
}
Thanks,
Rich
rjzinger is offline   Reply With Quote
Reply

Bookmarks

Tags
table view, tableview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 346
13 members and 333 guests
dansparrow, dre, iOS.Lover, lorrettaui53, Nobbsy, Objective Zero, oztemel, pbart, PlutoPrime, samdanielblr, sledzeppelin, thephotographer, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:50 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0