NSTableView Layout issue with Highlight and Background Color - objective-c

I am basically trying to recreate the popOver that exists in certain Xcode Settings, like this one in Build Settings:
I have tried both with and without using an NSArrayController to control the content but in each of the tests I ran in to different problems I haven't been able to solve.
Desired Result
Complete White Background
Multiple Selection and (Single) Editable Cells
No Reordering is required
When I press the + button I want the new cell to be selected and in edit mode
I want to get notification of when text changes while editing to be able to respond to that.
1. Using Delegate Methods.
When I had set up everything up I got this result:
That didn't look good, so I went and selected "Draws Background" for the NSTableViewCell, which resulted in this which looks nice when I edit a cell:
But when i just Highlight the cell, it looks like this:
It looks like the highlighting get's placed behind the cell background.
Here I'm stuck and don't know how to fix.
2. Using NSArrayController
When I reconfigure and bind this to an NSArrayController the highlighting looks great:
But when I edit a cell, the entire background changes to grey:
This is also not what I want, but can't figure out what to do about.
--
Notes
In Desired Result I listed some things like "When I press the + button I want the new cell to be selected and in edit mode" and "I want to get notification of when text changes while editing to be able to respond to that." To possibly influence the choice of what route to take, as there are more things about thins TableView I haven't figured out.
But this question Is all about how to fix the highlighting and selection so they stay white all the time, and just selecting a cell looks as expected.
Example Code
Example code for the Delegates Method version:
https://github.com/erikberglund/StackOverflow/tree/master/TableViewDelegates
Example code for the Bindings version:
https://github.com/erikberglund/StackOverflow/tree/master/TableViewBindings

Force the appearance to aqua. So instead of inherited select aqua. This solved the issues for me.

Related

Show UITableView editing mode options on the right

I have a tableView implemented similar to the screenshot which I set the editing to true when the view is loaded up. This is to allow the user to have multiple selection option already available for them.
My problem is that I'd like to show the editing option (the round selection buttons) on the right as opposed to the usual iOS style on the left (which is how my app is atm) but I'd like to achieve what is shown in this screenshot. Anyone can advise on how to achieve that?
You'll need to have this as a checkbox within your cell's UI and handle the display (with or without animation) yourself. I'd add an isEditing flag in your tableview model items that handles that state.
Another approach would be to try reverting to RTL for that particular screen. Haven't tried that ever though and I would not recommend having something like that in production code.
[UITableView appearance].semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
or
self.tableView.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
That will most likely send the letter section to the left as well though.

NSOutlineView background scrolls with contents

My application has a NSOutlineView that was initially configured as a source list, because source lists are prettier. However, I decided that I'd rather have the normal tree behavior, so I switched the highlight mode from "Source List" to "Regular". Now the "Show" buttons on the right of top-level cells are gone in favor of familiar triangles to the left, but an unexpected issue arose: it seems that the background scrolls with the contents of the view.
The issue disappears if I select "Source List" again in the Highlight setting, but I'd rather have just the background and not the source list behavior.
How can I fix that? I didn't write a single line of that background's code.
I've seen this kind of error before. The background can become messy when switching back from SourceList highlighting. I usually just remove the outline, drags in a new one and set DataSource and Delegates (+ Class) again.

UTextView autocomplete vs live suggestions iOS

If I turn the autocorrection ON, the words get autocompleted, as if I write "wor", I get "word" before I finish writing. I don't want this to happen because I might be writing "world" or any word different than the autocompleted one.
I set Correction off in the Interface Builder and this problem is solved.
The problem now is that I still need the suggestions that appear in a little popover below the incomplete words.
This two features might be different but I don't know how to activate the suggestions.
How can I solve this?
This can be solved with the use of tableview. Create a tableview with the width as of the width of the textfield and height as you like. Place it just below the textfield. Make it hidden initially. When the user starts typing, fetch the array of data that resembles to the typed text and if any exists then, unhide the table view. On the subsequent typing keep on reloading the tableview sections with animations. You should be accurate on hiding, unhiding and then reloading the data on the tableview. I have implemented such thing before. It is really easy and once you get started with it you find it easy.
In the UITextView TextViewDidChange I created a thread that changed the cursor position. This, off course happens after the text view changes. The change of the cursor position triggers the autocomplete without letting me even see that there had been a suggestion.

How to skin the UITableViewCell image used when selecting multiple rows?

When you put the cell in edit mode and allow multiple cells to be selected at once, the UITableView shows a checkbox on the left of the cell, like below.
How do I change that image? Changing the cell.editingAccessoryView just adds another accessory to the right, instead of changing the left one.
Apologies for reading the question wrong at first. Best I can find at the moment is the multiSelectCheckmarkColor property on the tableview. This technically isn't what you are asking for... however, if simply changing the color is a sufficient solution for you then you might be interested this option.
The only working solution I know is not using the default editing mode at all.
You can easily add a custom checkbox to your cell and animate the cell to show it when entering editation mode.

Creating a view for user to fill up a form

I'm creating a view which provides some fields for the user to fill in - address, phone number etc.
I've seen apps that have populated fields with grey text like 'Fill in your name here' on the Name field, and when the user taps on it the text is gone, a keyboard appears and the view is zoomed in to the textfield(or whatever it is). Also, after filling up that field tapping the 'Next' button on the keyboard brings the user to the next field. I'm trying to do the same but I have no idea where to get sources on this. Pardon my poor googling skills ;p
Tried UITextView and UITextField but there isn't anything related to this on the Interface Builder. Figured it lies with the codes?
It'd be great if I can get some explanation or some links on how this works (: Thanks!
EDIT: okay I played around with the Interface Builder a lil more and realized I could set placeholder as the grey text.
It is in fact a UITextField.
You can get the greyed out text by setting its placeholder property.
I am not sure what you mean by zooming but usually they do use a scroll view or adjust the frame so that it isn't blocked by the keyboard.
The Next button is made available using a UIToolbar instance as the text field's inputAccessoryView. However the implementation is one's own and is not framework provided. You can look at this example to get started.