typedef - Objective C: NSRange or similar with float? -
for methods want them return range of values (from: 235, to: 245). did using nsrange
return value
- (nsrange)givemearangeformyparameter:(nsstring *)myparameter;
this works fine long return value integer
range (e.g. location: 235, length: 10).
but have problem need return float
range (e.g. location: 500.5, length: 0.4). read in doc nsrange
typedefed struct nsuintegers
. possible typedef struct float
ranges? , if so, can there similar method nsmakerange(nsuinteger loc, nsuinteger len)
create float
ranges?
although reuse 1 of several "pair objects" graphics library (you can pick cgpoint
or cgsize
, or ns...
equivalents) struct
s behind these objects simple better create own:
typedef struct fprange { float location; float length; } fprange; fprange fprangemake(float _location, float _length) { fprange res; res.location = _location; res.length = _length; return res; }
Comments
Post a Comment