I have a next button that I want to disappear when I get to the last result of an array and I want my previous button to disappear when I am at the first result of the array. I have figured out how to make them disappear when only one result is found.
Contacts is the array.
next Button:
//button look
if (contacts != nil) {
if ([contacts count] > 1 ) [self.view addSubview:nextButton];
Previous button:
//button look
if (contacts != nil) {
if ([contacts count] > 1 ) [self.view addSubview:previousButton];
I have tried this
if ([contacts count] < (index-1)) [self.view addSubview:nextButton];
I get this error “Ordered comparison between pointer and integer (‘NSUInterger'(aka ‘unsigned int’) and ‘char * (*)(const char *,int)’)” The button is there it just doesn’t disappear when it gets to the last result.
Any help would be greatly appreciated.
It sounds like index is a
NSUInterger. count is a int and NSUInteger is typedef to unsigned integer. try changing index where ever your setting it to a int or typecasting it to a int where your using it for comparison.For the part about the button, if your logic is right and you are trying to remove “nextButton” from view you can either hide or remove it from the view like so:
or