How to get check change the button image if it reach the last element of the array and perform to start from first on click that button?
Here my code,Please help me
-(IBAction)changenext:(id)sender
{
static int j = 0;
backimg.enabled=TRUE;
if(sender == nextimg)
j++;
else if(sender == backimg)
j--;
if (j >= arcount)
{
j = 0;
}
else if(j < 0)
{
j = arcount - 1;
}
imager.image=[arimage objectAtIndex:j];
}
What change should i made?
Hi i can not clearly understand what you asking but simply you get last element of
NSArraywith this code :-[myArray lastObject]For Example:-
NSString *str = [myArray lastObject]