Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting NSNumber to NSInteger

Tags:

I'm trying to determine what a value is in an array and then implement changes on the array, but I can't access the array in the first place...

NSNumber *row = [NSNumber numberWithInt:recognizer.view.tag];
    NSInteger *newRow = [row integerValue];
    NSInteger *index = [selectedItems indexOfObject:row];//0=Not selected 1=selected;
    NSLog(@"%@ & ",row);
    if (index == 0) {
        [selectedItems removeObjectAtIndex:newRow];
        [selectedItems insertObject:@"1" atIndex: newRow];
        [(UITableViewCell *)(recognizer.view) setAccessoryType:UITableViewCellAccessoryCheckmark];
    } else {
        [selectedItems removeObjectAtIndex: newRow];
        [selectedItems insertObject:@"0" atIndex: newRow];;
        [(UITableViewCell *)(recognizer.view) setAccessoryType:UITableViewCellAccessoryNone];
    }

As you can see I'm trying to get information from the row variable, which is a NSNumber and find the value of the array with the index variable. Also I declared this in my onload()...

selectedItems = [NSArray arrayWithObjects: 0, 0, 0, nil];

The problem is that I get all of these warnings saying...

Incompatible integer to pointer conversion initializing 'NSInteger *' (aka 'int *') with an expression of type 'NSUInteger' (aka 'unsigned int'); 

Whenever I use the varaibles row or newRow. As you can see newRow is just row as an integer. What am I doing wrong?