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 09-06-2010, 11:57 PM   #1 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 71
Coolio098 is on a distinguished road
Default indexPath.row value

Hey guys,

I'm completely stuck on this one problem and i've searched for a solution everywhere. I'm trying to store the integer value of the selected row into a variable. This is what I have so far:

Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	
	arrayPosition = [indexPath row];
	
	[gradeSummaryNavigation pushViewController:gradeSummary animated:YES];
}
It seems like its only storing nil into the "arrayPosition" variable. If I add any number to the equation ( arrayPosition = [indexPath row] + 1 ) it'll display 1 and so on. Any feedback would be greatly appreciated! Thank you in advance.
Coolio098 is offline   Reply With Quote
Old 09-07-2010, 02:43 AM   #2 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 107
JDave is on a distinguished road
Default

Code:
[gradeSummaryNavigation pushViewController:gradeSummary animated:YES]; // what is happening here?
you are assigning arrayPosition correctly... my guess is that you are displaying arrayPosition in a different view controller, named gradeSummary. In this case, you will need to send self.arrayPosition to the gradeSummary.arrayPosition

toss in an NSLog to prove you are assigning it correctly:

Code:
arrayPosition = indexPath.row;
NSLog(@"arrayPosition = %i", arrayPosition); //this should work
[gradeSummaryNavigation pushViewController:gradeSummary animated:YES];

Last edited by JDave; 09-07-2010 at 02:46 AM.
JDave is offline   Reply With Quote
Old 09-10-2010, 09:42 PM   #3 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 71
Coolio098 is on a distinguished road
Default

Thanks for the response JDave. I have arrayPosition declared as a global variable. How exactly would I send the value from one viewcontroller to the next? Sample code would be great if possible.
Coolio098 is offline   Reply With Quote
Old 09-10-2010, 10:38 PM   #4 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: Ypsilanti, Michigan
Age: 63
Posts: 1,549
RLScott is on a distinguished road
Default

Is it possible your table view has various sections, each with only one entry, instead of one section with many entries?
RLScott is offline   Reply With Quote
Old 09-14-2010, 06:54 AM   #5 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 62
devanshree.c is on a distinguished road
Thumbs up

Quote:
Originally Posted by RLScott View Post
Is it possible your table view has various sections, each with only one entry, instead of one section with many entries?
Try to retrieve the arrayPosition in the other viewcontroller as controllerName.arrayposition;
or declare the global variable in appDelegate class and try to set/retrieve it...
devanshree.c is offline   Reply With Quote
Reply

Bookmarks

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: 337
10 members and 327 guests
bignoggins, carlandrews, flamingliquid, hzwegjxg, ilmman, linkmx, nadav@webtview.com, stanny, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,656
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, iram91419
Powered by vBadvanced CMPS v3.1.0

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