mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-23 04:00:00 +00:00
Implement readFromURL:
in NSMutableAttributedString
This commit is contained in:
parent
2f6272f476
commit
7fcfc33365
@ -203,14 +203,22 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[self endEditing];
|
||||
}
|
||||
|
||||
- (BOOL) readFromURL:(NSURL *)url
|
||||
options:(NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *)opts
|
||||
documentAttributes:(NSDictionary<NSAttributedStringDocumentAttributeKey, id> * _Nullable *)dict
|
||||
error:(NSError * _Nullable *)error {
|
||||
- (BOOL) readFromURL: (NSURL *) url
|
||||
options: (NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *) opts
|
||||
documentAttributes: (NSDictionary<NSAttributedStringDocumentAttributeKey, id> *_Nullable *) dict
|
||||
error: (NSError *_Nullable *) error
|
||||
{
|
||||
NSAttributedString *str = [NSAttributedString alloc];
|
||||
[str initWithURL:url options:opts documentAttributes:dict error:error];
|
||||
//[self setAttributedString:str];
|
||||
NSLog(@"NSMutableAttributedString readFromURL: - hopefully finished reading!");
|
||||
return true;
|
||||
str = [str initWithURL: url
|
||||
options: opts
|
||||
documentAttributes: dict
|
||||
error: error];
|
||||
if (str == nil) {
|
||||
return NO;
|
||||
}
|
||||
[self setAttributedString: str];
|
||||
[str release];
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -258,11 +258,10 @@ enum {
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Getting Attribute Data
|
||||
- (void) enumerateAttribute: (NSAttributedStringKey) attrName
|
||||
- (void)enumerateAttribute: (NSAttributedStringKey) attrName
|
||||
inRange: (NSRange) enumerationRange
|
||||
options: (NSAttributedStringEnumerationOptions) opts
|
||||
usingBlock:
|
||||
(void (^)(id value, NSRange range, BOOL *stop)) block;
|
||||
usingBlock: (void (^)(id value, NSRange range, BOOL *stop)) block;
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Testing String Data Sources
|
||||
|
@ -26,13 +26,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (void) fixAttributesInRange: (NSRange) range;
|
||||
- (void) applyFontTraits: (NSFontTraitMask) traits range: (NSRange) range;
|
||||
|
||||
- (BOOL) readFromURL:(NSURL *)url
|
||||
options:(NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *)opts
|
||||
documentAttributes:(NSDictionary<NSAttributedStringDocumentAttributeKey, id> * _Nullable *)dict
|
||||
error:(NSError * _Nullable *)error;
|
||||
- (BOOL) readFromURL: (NSURL *) url
|
||||
options: (NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *) opts
|
||||
documentAttributes: (NSDictionary<NSAttributedStringDocumentAttributeKey, id> * _Nullable *) dict
|
||||
error: (NSError * _Nullable *)error;
|
||||
|
||||
- (void)addAttribute:(NSAttributedStringKey)name
|
||||
value:(id)value
|
||||
range:(NSRange)range;
|
||||
- (void)addAttribute: (NSAttributedStringKey) name
|
||||
value: (id) value
|
||||
range: (NSRange) range;
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user