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

View Single Post
Old 10-13-2009, 11:35 PM   #5 (permalink)
reena
Reena
 
Join Date: Apr 2009
Posts: 31
reena is on a distinguished road
Default

Quote:
Originally Posted by iphonig View Post
Hey everyone,
I'm working on an app that has a table view in it. I had no problem using it and navigation was working great but I decided that it would look more professional if I had the Name and than a mini summary of the next view when you tapped on the cell. I designed my custom cell but the problem I am having is loading up a new view when a particular cell is tapped. I used isEqual to the name of one of the arrays when I used a regular table view but now I get an error saying too many arguments to function 'isEqual'

Here is what my code looks like
Code:
NSString *customCellContent[][2]  = {
{@"Sample", @"blah blah"},
{@"Sample 2", @"blah blah"},
// and it keeps going
};

@implementation Sample
@synthesize tableContent, theCustomCell;

-(void) loadTestData {
	// fill moviesArray with test data
	for (int i=0; i< 10; i++) {
		CustomCell *theCell = [[CustomCell alloc] init];
		theCell.title = customCellContent[i][0];
		theCell.summary = customCellContent[i][2];
		[tableContent addObject: theCell];
		[theCell release];
	}
}

- (void)viewDidLoad {
	[super viewDidLoad];
	self.title = @"Sample";
	tableContent = [[NSMutableArray alloc] init];
	
	[self loadTestData];
}

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
	static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
	if (cell == nil) {
		[[NSBundle mainBundle] loadNibNamed:@"CustomCell" 
									  owner:self options:NULL]; 
		cell = theCustomCell; 
    }
    
    // Set up the cell...
	CustomCell *aCell = [tableContent objectAtIndex:indexPath.row];
	UILabel *titleLabel = (UILabel*) [cell viewWithTag:1];
	titleLabel.text = aCell.title;
	UILabel *summaryLabel = (UILabel*) [cell viewWithTag:3];
	summaryLabel.text =  aCell.summary;
	return cell;
	
}

//here is my problem
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	
	if ([[tableContent objectAtIndex:indexPath.row] isEqual:@"Sample", @"blah blah"])
	{
		SampleViewController *sample = [[SampleViewController alloc] initWithNibName:@"SampleViewController" bundle:nil];
		[sample setTitle:@"Sections"];
		ApptitutorAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
		[delegate.sampleNavController pushViewController:sample animated:YES];
		
	}
}
Any help would be greatly appreciated!
Thanks!
iPhonig


try this

if ([[tableContent objectAtIndex:indexPath.row] isEqual:@"Sample"] || [[tableContent objectAtIndex:indexPath.row] isEqual:@"blah blah"])
reena is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,283
Threads: 93,960
Posts: 402,310
Top Poster: BrianSlick (7,971)
Welcome to our newest member, bkdbkd
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:43 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.