I'm trying to diagnose a problem in UKSyntaxColoredTextDocument 0.4 http://www.zathras.de/angelweb/blog-uksctd-oh-four.htm where text that actually lives in a different font than the one you have specified disappears as you type. (You can download and try out this cool utility to see this problem for yourself...)
Here's the background:...
Hey guys,
Does anyone know what made Apple leave out NSAttributedString when turning AppKit into UIKit?
The reason I ask is that I would really like to use it in my iPhone app, and there appears to be no replacement or alternative than doing it myself...
It is possible to have mixed font attributes on a string - it's just a hell of a ...
I have a Cocoa app with an NSTextView control which holds its text in an NSAttributedString (actually I believe it's a NSMutableAttributedString). I can easily set and modify different text attributes (such as font, underline, etc.) on different character ranges inside that string.
However, I want to set a part of the text as hidden (si...
Hello all,
I've been trying to insert an image into the page footer of a custom NSView, so that when I print it, it will display text and an image in the footer. Here is the code that I am using:
- (NSAttributedString *)pageFooter {
NSString *imgName = @"Logo.tif"; ...
The text I use in an NSTextField is loaded from a file as follows.
NSString *path = [[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtf"];
NSAttributedString *as = [[NSAttributedString alloc] initWithPath:path documentAttributes:NULL];
[creditsLabel setAttributedStringValue:as];
[creditsLabel becomeFirstResponder];
The hyp...
I see for NSAttributedString has a specific attribute for superscript, but I can't find one for subscript. What is the general practice for using NSAttributedString to create a subscript character?
Example: H2O
...
I want to do some drawing of NSAttributedStrings in fixed-width boxes, but am having trouble calculating the right height they'll take up when drawn. So far, I've tried:
Calling - (NSSize) size, but the results are useless (for this purpose), as they'll give whatever width the string desires.
Calling - (void)drawWithRect:(NSRect)rect o...
Hi,
I've a text view that gets its content from an attributed string stored in a model object. I list several of these model objects in a drawer and when the user clicks on one the text view swaps its content.
I now need to also swap the undo manager for the text view. I initialise an undo manager on my model object and use undoManager...
Brand new to Cocoa and I'm trying to figure out how to copy an NSAttributedString to the pasteboard. I've looked in the docs and not sure if I'm supposed to use a NSPasteboardItem or not.
Here's what I have to copy a regular NSString:
NSPasteboard *pb = [NSPasteboard generalPasteboard];
NSArray *types = [NSArray arrayWithObjects:NSStri...
I know you can do it on Mac OS X with NSAttributedString but I haven't had much luck with that on the iPhone.
I'm trying to basically do a string like "$200" except the dollar sign is replaced by a custom symbol.
...
I need to add a custom attribute to the selected text in an NSTextView. So I can do that by getting the attributed string for the selection, adding a custom attribute to it, and then replacing the selection with my new attributed string.
So now I get the text view's attributed string as NSData and write it to a file. Later when I open t...
Hello!
I'm writing a QuickLook plugin. Well, everything works. Just want to try it make better ;).
Thus the question.
Here is a function that returns thumbnail image and that I'm using now.
QLThumbnailRequestSetImageWithData(
QLThumbnailRequestRef thumbnail,
CFDataRef data,
CFDictionaryRef properties);
);
http://developer.apple.com/m...
Hi,
This is not a specific bug, its more about not knowing how to do something.
I've an NSTextView and I need to paint the background of specific ranges of text when the user clicks on a specific part of the text view. I've tried this but I just get erratic behaviour in the sense that sometimes text loses the foreground color or the ba...
I have a NSTextField Label that has attributed text in it. The color and size are different from the defaults. (The text is a bit larger and green) Now, I need to be able to select the text in the label so as the click the hyperlinks embedded in the attributed text. This works fine; however, when selecting the text the format of the text...
I have a random string given below.
ungs- und AnimationsprogrammSport /
Unterhaltung: Gegen Ge
I would like to display the Sport text as a bold.
ungs- und Animationsprogramm
Sport / Unterhaltung: Gegen G
How should can I display text like this?
Thanx in advanced
...
I've seen a lot of questions related to colored text answered with "check out NSAttributedString", but the NSForegroundColorAttributeName constant that is defined for Mac OS does not seem to be defined for iOS 3.2+
...
SUMMARY
Create a numbered list in a NSTextView
Programmatically scale the text larger (by adjusting the NSFont for the attributed string)
Save the attributed string as a webarchive
When the resulting webarchive is opened in a web view, the numbers in the list appear partially off the screen (to the left). This only happens if the tex...
I have a placeholder string, a space character, in an NSTextView that I want to remove at a future time. My strategy is to assign the NSAttributedString a custom attribute and perform a search on the [NSTextView string] removing it. So far, I haven't found a good way to do this, outside of going through [NSTextStorage attributeRuns]. ...
Multiple colours in an NSString or NSMutableStrings are not possible. So I've heard a little about the NSAttributedString which was introduced with the iPad SDK 3.2 (or around 3.2) and is available on the iPhone as of iPhone SDK 4.0 beta.
I would like to have a string that has three colours.
The reason I don't use 3 separate NSStrings,...
I am developing an iPhone app and want to be able to use an NSMutableAttributedString inside a ScrollView. Here are the steps I want to follow:
Grab a string from CoreData.
Copy the string into an NSMutableAttributedString.
Parse the string and modify the attributes of portions of the text.
Display the NSMutableAttributedString inside...