2012年7月27日 星期五

Check Segue if not meet check condition then cancel

I use drag source to destination controller to create a seque. But in some condition, don't want to push to the destination. It seems that can not do in prepareforseque function. Search the internet and found the solution as below.

Finally I just to check the condition and disable enable and it also meet my requirement.

From hint:

Don't create the segue by dragging from the button to the destination controller. Instead, just drag from the source controller to the destination controller to create a segue. Click on the segue and use the attribute inspector to specify the segue is a push and give the segue an identifier (goToDestination). Then connect the button to an IBAction in the source view controller. In the IBAction method do your checking and if you want to do the push add this line of code:
[self performSegueWithIdentifier: @"goToDestination" sender: self];

沒有留言:

張貼留言