objective c - How to check for attribute on NSMutableAttributedString -


i execute block of code on nsmutableattributedstring iff attribute nsstrikethroughstyleattributename set. there easy way check existence of attribute?

what this:

nsmutableattributedstring *yourstring; //initialize these things before calling method below nsrange range; if ([yourstring attribute:nsstrikethroughstyleattributename atindex:text.length - 1 effectiverange:&range]) {     //dosomestuff } 

the documentation says returns "the value attribute named attributename of character @ index, or nil if there no such attribute.". have check if method returns that's not nil.

source: https://developer.apple.com/reference/foundation/nsattributedstring/1408174-attribute?language=objc


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -