Accessibility: didSelectRowAtIndexPath not called when cell selected with voiceover - objective-c

I have a very simple UITableView with a custom class for my cells. The cells consist of various labels (isAccessibility=NO).
I have an accessibilityValue set for each cell, and isAccessibility=YES/enabled in Storyboard for each cell.
When the user double-taps to select the cell...nothing happens. didSelectRowAtIndexPath, which contains my navigation logic, does not get called. At other locations in my app that use segues work fine, with the same cell setup.
What am I doing wrong that would make didSelectRowAtIndexPath not get called?
Edit: this code works fine without Voiceover. Tapping the cell calls didSelectRowAtIndexPath as expected. Voiceover simply isn't triggering didSelectRowAtIndexPath.

I have got the same problem.
Fix below work for me
cell.isAccessibilityElement = YES;

Related

UICollectionView selection/deselection methods not triggering

Basically I have a UIPageViewController which has multiple UICollectionView on each pages.
The problem is I can select/deselect on collectionViews inside the first page. But when I switch to second page, numberOfSections, numberOfItemsInSection, cellForItemAt are all called however the selection and deselection delegate methods are not called at all.
here is the link to the code:
https://gist.github.com/anonymous/4eca4ff9f3e4423c01974609aeae5482
I can't connect to your link. But you must make sure delegate of UICollectionView was set and check allowsMultipleSelection and allowsSelection is YES. You can reference links below:
UICollectionView - didDeselectItemAtIndexPath not called if cell is selected
iOS: UICollectionView cell selection not working

Creating a segue for a TableViewController cell's detail accessory button

I'm trying to implement segueing from a tableview controller when the user taps the cell's accessory button.
I've searched on here and have some new things to try but I just wanted to ask whether in the storyboard you can actually create the segues from the accessory button, or whether you just need to create them from the tableviewcontroller.
It'll be within the accessoryButtonTappedForRowWithIndexPath that I'll want to act on the tap, but I see some answers on here say that you have to just go from the tableviewcontroller when creating your segues where as another answer said that the sender within prepare for segue would be set to the cell that contains your accessory view.
Whenever I try to ctrl drag from the accessory button in my prototype cell it just gets rid of the already existing on-selected segue I'd setup for that cell.
Just wanted to know for sure, what the best practice was before I started making all my detail accessory segues just go from the root TableViewController and passing through accessoryButtonTappedForRowWithIndexPath's indexPath (or it's row) as the sender to my prepareForSegue.
Cheers
Ok, after trying the suggestions I described in my original question I got the code all working how I wanted. I added segues from the root tableview controller and then performed them programatically within the accessoryButtonTappedForRowWithIndexPath delegate function.
I have a few Table View Controllers doing similar things in my navigation controller so I set about implementing this accessory button workflow in each of them. When i reached the last TVC in my nav controller hierarchy I didn't want selecting cells to go any further, so i changed the accessory type to just detail.
As I wasn't concerned at this stage to have the cell interaction sourced segues overwriting each other I just dragged a segue out from the prototype cell to the destination view controller. Upon doing so within the add segue popup I saw 2 options - Selection Segue and Accessory Action. I'm sure that when I first tried doing this I only had the single Selection Segue choice.
Regardless of whether this was my tired eyes missing it, or Xcode having a funny turn (as it seems to from time to time, being laggy at updated states of various files etc) I can now say in answer to my original question, all you have to do is setup your accessory action segue as required. You can have both selection segue and accessory action segues setup from the same prototype cell, and everything just works as you'd expect.
I've just updated my setup to work this way and all seems fine.
Cheers

Table View Checkmark if Task Complete

I'm working in Objective C. I have a UITableViewController with about 25 cells that push to a UIViewController. When the user hits back, I want to see if the user entered the correct data for the given cell. (I have a working bool , we'll call it isCellComplete for now). If isCellComplete is true, I want to add a checkmark as the accessory to the cell. I've been trying to put the test in cellForRowAtIndexPath but that method does not seem to run and refresh the cells everytime the view appears. Anyone have suggestions?
You should look into the UITableView method reloadRowsAtIndexPaths:withRowAnimation:. This is much more elegant than reloading the whole table view. And if you don't want an animation, you can specify UITableViewRowAnimationNone and it will look just like reloadData but be much more efficient.
You should do the check in tableView:cellForRowAtIndexPath: and if the check passes, set the cell's accessory to UITableViewCellAccessoryCheckmark. Then when you tell the table view to reload the appropriate row(s), it'll automatically call tableView:cellForRowAtIndexPath: on the data source and update that cell.
You could just call
[self.tableView reloadData];
in
-(void) viewWillAppear:(BOOL)animated
And that will make cellForRowAtIndexPath be called again when the view appears

IBAction in table cell view won't be fired

I am making my first Mac OS X application and I'm stuck with a problem.
I created a NSTableView on my window linked to a NSArrayController and I'd like to call a method after stopping to edit a textfield cell. So I've selected to call an action when end editing, as you can see in the following screenshot:
After, I've created an IBAction for it:
It generated this code in my AppDelegate.h:
- (IBAction)stopEditingHeaderNameCell:(id)sender;
And then I edited the IBAction in AppDelegate.m in order to show a NSLog message when the cell is edited:
- (IBAction)stopEditingHeaderNameCell:(id)sender
{
NSLog(#"test");
}
However, when I stop editing the cell by pressing enter or clicking in another element, nothing happens. I already tried to apply this IBAction to a NSTextField and it works perfectly, but it doesn't call the IBAction when applied to this text field cell.
Can anyone help me to solve this?
Thanks!
This is not the way you do this with text field cells in a table view. You need to make your app delegate the delegate of the table (you can connect this in IB), and then implement controlTextDidEndEditing:. This method will be called when you end editing (by tabbing out of the cell or clicking on another row or column).

Multi-selection behavior at user selection differs from setSelected:animated:

I have a UITableView that displays contacts from AddressBook. I have the multi-selection editing style enabled. When I present the tableView, it works as intended. The user taps a row and the red checkmark to the left side of the cell fills in. Great.
I save these selections in an array property on the presenting view controller. When I show my table again, I would like for these cells to remain selected (i.e., not blue highlighted, just with the red check mark still filled in). In cellForRowAtIndexPath: I get the object for the cell at that index path, test whether the presenting view controller's array contains that object, and if so [cell setSelected:YES];
It seems to me that this should result in the same selected appearance as when the user touches a cell (just the red check mark). Instead, the red check does fill in but also the cell highlights blue momentarily and the text turns white permanently, creating the impression that the contact's name has disappeared. I'm happy to post code if it's helpful but this seems like maybe just a quirk of UITableView that someone might be familiar with?
EDIT: This image shows the kind of checkmarks that I have (and want). I can't piece together though why when I call [cell setSelected:YES]; it behaves differently than it does in response to a touch. What you're looking at here is after I call [cell setSelected:YES];. And it looks almost how I want but the names have disappeeared. And I don't want the cell to highlight when the list appears.
If I understand the visual effect you're looking for, you should be getting it by using cell.accessoryType = UITableViewCellAccessoryCheckmark; rather than [cell setSelected:YES];.
This is resolved. In think I was making problems for myself by trying to setSelected in cellForRowAtIndexPath. Maybe the table view's reusing of the cells was making it act crazy?
The solution for getting the cells to select correctly between presentations of the multi-selection style table was to store the selected indexes at viewWillDisappear. I gave the presenting view controller a property NSArray *selectedIndexes, and in viewWillDisappear called
[self.presentingViewController setSelectedIndexes:[myTableView indexPathsForSelectedRows]];
Then in viewWillAppear, I put that array into an ivar, iterated through it and called [myTableView selectRowForIndexPath:[selectedIndexes objectAtIndex:i] animated:YES];
That did the trick. Thanks to user523234 for the comment. Helped get me thinking on the right track.