ios - How does NSrange work here? -


I saw a video about ios7 programming and saw the piece of code below.

I can not really understand how the variable range works here.

We create a NSR variable variable and never give it a price, so I think the end range pointer should be returned from zero.

Can be used in the effective range and how much the value is in the range. Location and category. Length?

Thank you very much for the help!

  - (NSMutableAttributedString *) charactersWithAttribute :( NSString *) attribute name {NSMutableAttributedString * characters = [[NSMutableAttributedString alloc] init]; Int index = 0; While (index & lt; self.textToAnalyze.length) {ennange range; ID value = [self.textToAnalyze attribute: attributeName atIndex: index effective range: & amp; category]; If (value) {[Attach characters: string: [self Texanage attributed asbestring formation: Range]]; Index = category.location + border Lamps; } And {index ++; }} Returning character; }   

declare allocated memory on the NSRange Range stack (In the local area) This memory is tied to a memory address which is accessed by and the category When you pass this memory address in the method, the method will be as that address Uses the address, for which it specifies the value. After the method returns, the value associated with category will now be assigned the value, when you access them (to send them to attributedSubstringFromRange: ), everything will work as expected < / P>


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -