Show UITableView editing mode options on the right - objective-c

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.

Related

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.

What Cocoa Views and Controls Will Create Something like Part of the Network Prefs Display (Mac OS)? [duplicate]

This question already has an answer here:
NSTableView with +/- buttons like in System Preferences using only Interface Builder
(1 answer)
Closed 7 years ago.
I'm building an OSX app and want to create a set of controls similar to what's found at bottom of the standard Network Preferences configuration panel. I'm running into some layout problems that I wouldn't have expected.
These are my specific questions:
What contains the 3 buttons so there's similar shading all they way across the row where the buttons are positioned? In particular, what's causing the area without buttons to have shading?
How do you do this without getting a double border where the row of buttons meets up with the table?
I want to do this with an xib file. This may be incredibly simple, but I'm missing something I guess.
I find that if you make a button with style "Gradient" and type "Momentary Change", then it looks like the other buttons but does not respond to clicks, so you can use that as the area after the last button. (The NSMomentaryChangeButton is documented as changing the image and title when clicked, so if you don't use an image or title, nothing should change.)
If you check Refuses First Responder in the attributes inspector, then it will not be possible to highlight this blank button using Full Keyboard Access.
Ken Thomases also brings up the issue of the blank button being shown as a button to Accessibility. One can fix that by using a subclass of NSButtonCell that has just one method:
- (BOOL)accessibilityIsIgnored
{
return YES;
}
I think that's easier than writing a custom view.
As d00dle says, avoid double borders by slightly overlapping things.
Since you want the slack space to have the same background as the buttons, and since the buttons can change appearance from release to release of the OS, the best thing to do is to get the frameworks to draw it like it would the buttons.
Rather than using an actual button as JWWalker suggests, I have used a custom view that leverages NSButtonCell to draw the background. The advantage is that you can be sure there's no chance of getting undesirable behavior. For example, a button could get focus (for users who have All Controls selected in System Preferences > Keyboard > Shortcuts > Full Keyboard Access) so that the user could Tab to it. Accessibility will report the presence of the button through VoiceOver. Etc.
Configure the button cell just like the buttons (set buttonType and bezelStyle). In the view's -drawRect: call [buttonCell drawWithFrame:rect inView:self];, where rect is similar to the frames of the buttons. Since one way to avoid double borders is to make the buttons larger than the view's bounds, you may need to do the same for rect. For example, you might want to use NSInsetRect(self.bounds, -1, -1).
The buttons are buttons... This can be accomplished with a custom view drawing border and the background "shading".
To avoid the double border where the table and the custom view meet you simply align it so they overlap by 1 point (pixel) or avoid drawing the top border in your custom view.
I don't know of any standard object capable of doing this.

What technique will I use if i want to change this panel when I click a button in VB

I just have it in my mind. And I can't explain it so here it goes.
A system that only uses 1 form?
It have a two panel, left and right.
The left is consist of buttons
Then the right is associated on the buttons and will change whether what button will be clicked.
Any ideas?
My preference is to do this via custom controls, rather than panels... but panels can work too.
There are a number of ways to do this:
Keep all of the controls layered on top of each other, and then set the Visible property to false for controls/panels you don't care about and to true for the Control/Panel that you do
Move the controls you don't care about out of the visible area
Remove/Add the Controls/Panels from Form's controls collection entirely
I think you can also get a TabControl to put the tabs along the left side, with some formatting that looks more like buttons, such that what you want will be handled without needing to write any code to switch layouts
Any of those can work. Whichever option you use, I have two recommendation for controlling layout and making the transitions smooth.
Call SuspendLayout() before making any changes, and then call ResumeLayout() when you're done. This will help avoid stuttering or a partially rendered form.
Look at the TableLayoutPanel Control. This control will allow you to arrange your top-level panels so that they can be resized with proportion. If you also then dock your individual panels, you can quickly build your program so that it resizes correctly.
You can have several panels, one on top of another. Change their visibility, depending on which one you need at a given moment.
Option #2 would be using a vertical tab control (or a tab strip - see another answer there).

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.