I think I would like to pack a section index and a row index together into an int and assign the result to the tag property of a UIView. I thought I could do it like this but it doesn’t work:
typedef struct
{
int16_t section;
int16_t row;
} SecRow;
SecRow sr = {2,3};
UIView* aview = [[UIView alloc] init];
[aview setTag:sr];//Error - Sending ‘SecRow’ to parameter of incompatible type ’NSInteger’ (aka ‘int’)
or
[aview setTag:(int32_t)sr];//Error - Operand of type ‘SecRow’ where arithmetic or pointer type is required
I realize this would limit maximum values for section and row but I think 16 bit should be enough. In the past I would simply multiply section by 1000 or 10000 and add it to row, but I’d like to come up with the least limiting way of doing this. I would also like to avoid manipulating bit fields if I can.
How can I do this?