Disclosure Indicator not triggering accessory action segue - ios

I'm trying to segue from a tableview to a viewcontroller embedded in a navigation controller using a show accessory action segue and the disclosure indicator (Shown in picture). Clicking anything including the disclosure icon does nothing. If I change the segue from "accessory action" to "selection," the segue works, but thats through clicking anywhere in the tableview cell as intended. My goal is to use "accessory action" to segue only when the disclosure indicator is pressed.
I know there are programmatic ways of doing this but those aren't working either. I'm assuming the underlying issue preventing this operation through a navigation controller is also preventing the programmatic methods from working. How do I get the disclosure indicator to segue to another view controller?

accessorybuttontappedforrowwith only works when the accessory type is equal to "detail disclosure" AND accessory view is nil. Therefore it will never work with "disclosure indicator."
Days of research tell me that the community consensus is that there is no explanation as to why this is other than thats what apple engineers decided and that the "disclosure indicator" is simply symbolic as opposed to a button from which methods can be invoked. Most agree that it doesn't make any sense given the existence of the above method.

Related

Unwind segue function with Back button

I'm trying to call function when i'm pressing default Back button (e.g. < Settings) in Navigation Controller.
At other situations i'm creating custom button, after i'm Ctrl+Dragging to red Exit button in XCode and pointing it to Selection segue.
Now i need to use default back button of navigation controller, but i can't set assign it to segue action because it's no back button in Storyboard view (but it exists in Simulator).
Simulator:
XCode:
I can create custom button in navigation contoller and assign it so custom unwind segue, but that button will be ugly without "< " symbol.
I've found some answers at stackoverflow, but they all are written in Objective-C :(.
You can use a delegate method to accomplish what you are doing.
Here is a really thought out swift tutorial that deal with delegates and segues:
http://makeapppie.com/2014/07/05/using-delegates-and-segues-part-2-the-pizza-demo-app/
What you are asking, ability to catch the back button's action, isn't possible the way you describe it.
Most people would recommend creating a custom button, then use an unwind segue.
There are lots of tutorials on custom back buttons just in case you're new to swift, and the ugly part of the custom back button can be easily fixed by putting your own arrow there.
Also I found this previous asked question for future reference: Unwind segue from navigation back button in Swift
Actually I just assigned the unwind segue to the entire view controller (right click from the yellow view controller outlet and drag to the exit outlet then select the function). And it works great so far. No need custom button, no delegate.
In fact, in my project the child is supposed to call the different parent's function according to current caller view controller and simply using the same function name made my dreams come true.
This page helped me a lot: http://spin.atomicobject.com/2014/12/01/program-ios-unwind-segue/

Call segue with Disclousure indicator won't work

My question is very similar to this:
Disclosure Indicator doesn't call seque while Detail Disclosure does
But is a bit different.
The same is happening to me. I have a dynamic table view which loads some rows at viewLoad.
So I set the segue from the Cell to a new View which will show some details of the item. I also set the Segue to Push.
When I do that, the Cell automatically sets its Accessory to Detail Indicator (So the blue info button appears) This works fine, I click on the info button and it loads the new view. But I do not want that, I want the Cell to have a Disclousure indicator (the arrow) and whenever you click on the entire row, just Push the new view. I did this on an Static Table View and it worked fine, but I can't make it work with a Dynamic Table. Nothing happens when I click, just the animation of the tap and nothing else.
No, it's not ok to change an accessory action segue to a selection one by setting the accessory to none -- that doesn't change the segue type. The fact that you got the blue button when you made the segue means you chose an "Accessory Action" segue. When you drag from the cell to the next controller and let go, you get a menu of choices that's divided into two sections. The top ones are Selection segues, and the bottom set are Accessory Action segues. You need to delete your segue and remake it, being sure to choose from the Selection segue choices.

Disclosure Indicator doesn't call seque while Detail Disclosure does

I have an interesting problem. I'd like to have detail screen pop up when people click on the arrow in the Table View. The cells are dynamic.
When I select Disclosure Indicator - I do not get the segue called and and I don't get accessoryButtonTappedForRowWithIndexPath called either. When I change it to Detail Disclosure everything works just fine.
Any guesses to what I can do to make the disclosure indicator act just like the detail disclosure?
Thanks!
Disclosure indicators are not buttons and therefore do not cause the tableView:accessoryButtonTappedForRowWithIndexPath: delegate method to fire, while a detail disclosure is a button and therefore does fire that method.
The best you can hope to do, I imagine, is to add a UIButton to your table view cell and give it an image that very closely resembles the default table view disclosure indicator. This is kind of a hacky solution though, so I would discourage you from actually doing this.

Xcode is auto-adding an info icon / "Accessory Button" to my table cells

Lately, when I try to add a seque to my UITableView cell using the storyboard:
Xcode is auto-adding an info icon / "Accessory Button" to the cell:
I know I can remove it like so:
However, there appear to be other issues that might also be symptoms of whatever is causing this behavior, but that's a separate question... My question here is why is Xcode adding it in the first place? It's never done this before when I've added storyboard seques...
During creation of the segue you have selected "Accessory Action" in the segue action popover. If you do this Xcode will set the accessory to "Detail Disclosure", because you need a tappable accessory to have an accessory action.
Select a Segue in the upper part of the popover. Those are Selection Segues, which are triggered when you select the cell.
This does explain your other issue as well. Because your segue is connected to the accessory, which you remove. So there is no way to actually trigger your segue.
Select the cell and go to the attributes inspector
Scroll down to Accessory
In the drop down menu you will be having etail Disclosure selected
Change it to Disclosure Indicator
There are two different behaviors for the segues.
You can see them on your inspector: triggered segues.
If you choose the accessory action, Xcode automatically add an accessory button (the circle).
If you choose the selection action, you have no accessory button.

iOS - Push Segue not working even with NavController

I'm trying to set up a basic "Newsfeed" function for an iOS app, with headlines in a TableViewController segueing into a simple ViewController to display the text of the selected story. I'm using Storyboards to set up the segues, and I can't get it to work...
What I've Done - I started by CTRL+Dragging from the Cell of the TableView onto the secondary ViewController and choosing "Selection Segue - Push." Then I clicked on the segue and gave it the identifier "newsArticleSegue," and I embedded the TableView in a Navigation Controller. I've got the TableView data source hooked up to a plist file as well, although I don't think that would have any effect on the segue, right?
All that happens when I run the app and click on a row of the TableView is that it gets highlighted blue. Clearly the segue isn't working, but the tutorials I've found only list those steps, as though that's all that's needed...
Can anyone tell me what I am missing? And thank you in advance!
When you create the segue with IB, you can drag from the view controller (which you did) or from the table view cell, which will call the segue if the table view cell is selected.

Resources