I cannot seem to find this and hope it is a FAQ somewhere. How can I get the minimum NSRect needed to draw an NSAttributed string on OS X? I am doing an overlay borderless window, but I want to constrain the size based on what is needed to display the string.
How can I determine the minimum NSRect for drawing an attributed string?
145 Views Asked by uchuugaka At
1
There are 1 best solutions below
Related Questions in COCOA
- How do I customize NSOutlineView to have border color?
- How to generate request format for WCF web service method for Mac and iPhone
- How to Handle Command Line Prompt from a Cocoa App
- Change views inside NSSplitViewController
- CMYK NSImage get pixel data
- Reactive Cocoa Conditional Split ?
- Set background color of NSImageView with proportionally sized image
- Use NSWindow or NSViewController?
- Imports and includes in header files - when is it okay?
- How to prevent the app from automatically open a window when launched?
- Swift NSViewController responds to mouseDown event, but not keyDown event
- "stringByAddingPercentEncodingWithAllowedCharacters" replaces more characters than it should
- cocoa - what happen when close a window (by pressing the red X button)?
- Does it necessary to go back to main thread to update UI?
- WebView not responding to Keyboard input
Related Questions in DRAWRECT
- Is it safe to call [subview setNeedsDisplay] inside [superview drawRect:]?
- Why are 2 lines rendered with this code (drawRect)?
- UIBezierPath only renders part in clip rect when drawn from a view's drawRect/draw(_:)?
- CALayer drawrect Anti-Aliasing didn't worked
- How many ways to calculate the FPS (Frames per second) of an iOS App programmatically?
- iOS : WHO'S in charge of refreshing UI/Screen while UITableView's scrolling?
- Create hundreds of uiview and move them from right to left then dealloc them
- iOS drawing goes wrong when drawing view is transformed
- DrawRect, FillRect and DrawOval anomaly
- UIView class properties seemingly disappear when I call drawRect:
- Drawrect memory leak
- Gesture Recognizer Blocking TouchesEnded
- Custom NSProgressIndicator drawrect always called while hidden
- inserting an image in view or delegate
- DrawRect Square/Rectangle user values
Related Questions in NSATTRIBUTEDSTRING
- NSAttributeString - How to remove auto formatting for a date or time item?
- JSQMessagesCollectionView - How to force the attributedTextForMessageBubbleTopLabelAtIndexPath to 100% width?
- Tap action on some part of attributed string in iOS
- Click on keyword in UILabel
- UITextView lineHeightMultiple Clips Top, first line, of Text
- How can I use ASTextNode with TTTAttributedLabel
- Change first line color of UILabel
- Dynamic height for uiwebview with html data
- How to color HTML links using NSAttributedString in iOS
- Split NSAttributedString into Image + NSString
- how to add specific attributes to a NSAttributedString in Swift
- Multiline UIButton autosize per line
- Add attributes to all emoji in an NSAttributedString?
- Underline in attributed text not working in iPhone 6+
- How to make a string with multiple parts which can be touched in iOS?
Related Questions in NSRECT
- Is it possible to fill NSRect with a particular pattern using NSBezierPath?
- Updating NSRect size with negative value
- Put NSRects into an array, as objects?
- Copies of NSRects not displaying
- Drawing with drawRect method - Cocoa
- cocoa - draw image in NSRect
- cocoa - add NSTextfield to NSRect
- What is the unit of NSPoint, CGPoint, NSSize, CGSize and NSRect, CGRect?
- NSRect geometric properties
- NSRect.fill() not working with clear colors on Xcode 9 Swift 4
- Get NSView screen rect and display ID
- drawSwatchInRect drawing diagonal line when using NSColor with Alpha
- How to get NSAttributedString substring that fit specific rect?
- Changing size of non-standard windows (Adobe CS6, MonoDevelop, etc)
- How can I determine the minimum NSRect for drawing an attributed string?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
use NSTextContainer and NSLayoutManager. More from Apple here: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TextLayout/Tasks/StringHeight.html