• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Major Nubie : adding ints get strange values?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Major Nubie : adding ints get strange values?


  • Subject: Major Nubie : adding ints get strange values?
  • From: d2kagw <email@hidden>
  • Date: Thu, 6 Apr 2006 22:24:56 +1000

Hi there,

Apologies for the major newbie question...
Heres some code from an app im writing, im getting really strange data from the variable currentIndex.
instead of getting 1 or -1, I get 4 or -4, and if I run [self left] again, I get 8 and then 12, 16, 20 etc


im sure its something REALLY simple that i've just missed... but I can't find anything in the net !?

- ( id ) init
{
currentIndex = 0; <-- currentIndex is an int, its declared in the header

return self;
}


- ( void ) selectChild:(int *)selectedIndex
{
	currentIndex = selectedIndex;

	NSLog(@"moving : %i", currentIndex);
}

- ( void ) left : ( NSNotification * ) notification
{
	[self selectChild:( currentIndex + 1 )];
}

- ( void ) right : ( NSNotification * ) notification
{
	[self selectChild:( currentIndex - 1 )];
}

thanks a gazillion for your time

- Aaron
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Major Nubie : adding ints get strange values?
      • From: Charlton Wilbur <email@hidden>
    • Re: Major Nubie : adding ints get strange values?
      • From: Christian Stieber <email@hidden>
    • Re: Major Nubie : adding ints get strange values?
      • From: "Clark Cox" <email@hidden>
  • Prev by Date: Re: Thread safety issue...
  • Next by Date: Re: Major Nubie : adding ints get strange values?
  • Previous by thread: Re: What's wrong with this code?
  • Next by thread: Re: Major Nubie : adding ints get strange values?
  • Index(es):
    • Date
    • Thread