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

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.

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.

NSTableView Layout issue with Highlight and Background Color

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.

checkbox at the center of a NScheckboxcell

I am unable to center a checkbox inside a checkbox cell. Tried programmatically and over IB but without luck.
To reproduce add a NSTableView and in this add a NSCheckboxCell. edit the text of the checkbox to an empty text. Now try to center the box with the alignment button inside the cell. it will stay at the very left.
How can this be done? I would need to do it programmatically so if the answer is for a pro grammatical solution its better. If it is in IB then I am ok anyway and will find the programmatical version myself.
IB-Version would be to set the 'Position' to be centred.
Change it to be the value in the screenshot.
I'm currently looking for a non-IB-Solution but the docs don't say anything ...
The non IB answer is to set the image position.
i.e. swift would be "btnCheck.imagePosition = .ImageOnly"
and ObjC would be [btnCell setImagePosition:NSImageOnly]

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.

Custom Background Image on Grouped UITableView

How would I go about setting a custom background image for a UITableView. The wrench in the works is that the table is a grouped style (rounded top corners for the first cell and rounded bottom corners for the last cell). I would like do this as much in code as possible without relying on images too much.
Ideally, here is the solution, but I have no idea if this will work or not:
Create one custom background image
Apply the same custom background image to every cell
Rounding occurs automatically because it is a Grouped table style
Profit.
Is this how it works (besides the profit part... I am an app developer, after all)? Do I need to re-think my approach or is this possible? How would do what I described (or another approach) in code specific to iOS 5+?
Update
Just to clarify a bit, the main question I'm asking is: Does the rounding still occur on the top and bottom cells even if you are using a rectangular image?
Well I think what you are saying is ok, but I suggest creating a unique cell layout in a .nib file and apply there the background. Then, with initWithNibName you can manage every cell at the UITableView's methods on the ViewController.