简体   繁体   中英

How to get a NSRange Value from NSConcreteValue?

The code is like this. My question is how to get the NSRange value from the id type?

-(void)clicText:(MyLabel *)label clickedOnLink:(id)linkData{
     NSString *message = [NSString stringWithFormat:@"LinkData is %@:%@",[[linkData class] description],linkData];
}

I get the type is NSConcreteValue and the data value is NSRange:{0,4}; but how do I get the NSRange from the NSConcreteValue ?

I have already tried the [NSValue valueWithNonretainedObject:linkData]; but it does not make sense.

使用rangeValue方法:

NSRange range = [linkData rangeValue]; // assume linkData is NSValue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM