Save and load text font in textview. (Xcode) - xcode

I was wondering if any one knew how to save an load fonts on a textview. The app lets the user select the font for the text view but when they switch views and come back it is gone. Does any one know how to save that and then load it. Thanks so much.
Also if any one know how to save text color that would due great also.
Thanks so much!!

What you have to do is to give all the textViews a specific tag values and on navigation before view willDisappear you have to store all the values to array and on navigating back to the view on viewWillAppear fill all the textViews using the tag values.

Related

Why is the titlebar overlapping view controller content?

Can anyone tell me why this is happening and how can I fix this? I thought the content is suppose to display after the titlebar, not under it. The only way for me to fix this is to create a new project.
The Button on top is being overlapped by the titlebar. Not sure how that became possible. There's a lot of room for the window to adjust the view controller but not sure why it's not doing that.
Check window properties. You might have enabled “Full Size Content View” property.

Swift resize view based on shown Items with autolayout

so im toying around with Autolayout with a Storyboard.
So i have a View, containing a Button and to its right a TextField. (Sadly i cant post Pictures here yet) ;)
now what im trying to do, is that by default, when my view gets shown the button is hidden, and the view kinda resizes it self to only contain the Text field.
And after the text field is clicked (selected) the button is shown and with this the view resizes itself to fit the button and the Textfield.
I think i might be able to do that in code, by simply updating the View width with the width of the contained and shown items.
But i feel like there has to be a easy way to do that with Autolayout.
So i tryed many things, but it just doesnt work, no matter what constrains i add.
How can i solve this ? Thanks in Advance.
EDIT
i forgot to mention, even if i remove the button from the superview i get bad results, i suppose the reason is that the constrains get messed up if i remove the Button.
So thats not an Option.

Cells don't resize when user resizes NSTableViews columns?

I have found that the text in a table view doesn't grow when the user resizes the column. (Or for that matter shrink if he shrinks the column, because the truncation ellipses then vanish.) Having gathered that this is something to do with constraints, my solution has been to uncheck Use Auto Layout (in the xib's file inspector). Not a big deal, but it comes just when I was beginning to think I might have mastered Autolayout.
Is that really the only way to do this?
The table is view-based, and gets its data from Core Data via an array controller. The text is displayed in an NSTextField.
It is as you have found out yourself.
If you want to know/learn more about NSTableview-behavior search for "TableViewVariableRowHeights" and "TableViewLinks" in Apples documentation and download the samples.
This question appears to be answered in:
How to Expand NSTableCellView Width When Resizing Column in NSTableView
summary: add horizontal constraints to the table view cell
see the link for screenshots

cocoa get drag and drop content without dropping

Is it possible for a menubar application icon to receive text by hovering it over the icon? I need to know how many characters are in the content before it is dropped on the icon. and if there is too many characters in the content i want the green circle on the cursor to turn red. Is this possible? What methods would i use to accomplish this? I could not find anything helpful on the documentation page.
The NSDraggingInfo is provided for -draggingEntered:, so you would have access to the draggingPasteboard containing the object even before the drop occurs.
As to changing the cursor, you would need to provide your own. Have a look at the NSCursor documentation.

NSTextView: loading RTF, view does not update correctly until mouse is moved over the control

I have a pretty simple window that contains an NSTextView. I'm calling readRTFDFromFile: to load and display an rtf file on disk. I'm calling this from within the awakeFromNib handler. When the view appears on screen it only partially displays the contents of the rtf, the button portion of the view is blank/white.
However, when the mouse is moved over the control, the rest of the rtf is correctly rendered, filling the previously blank space.
I'm at a bit of a loss as to why this is happening. Any ideas?
turn off "non-contiguous layout" in interface builder
A photo of the view would help immensely, but have you tried marking the view as needing display ([view setNeedsDisplay:YES]) after reading in the RTF data?

Resources