I just want to simply save the selected index as integer but the code below returns a weird value and can get the index as an integer, what is wrong here?
NSInteger *selectedRow;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
self.selectedRow=(NSInteger *)indexPath.row;
}
I assume
selectedRowis anNSInteger, which is not an object type, just a typedef of an int (long?) primative. Thus, you don’t want a pointer to anNSInteger, you should remove your cast(NSInteger*)and just leave: