Disable Swift modal view

EDIT: Thanks to the person behind the answer below who installed the unknown class. However, can anyone tell me if it is correct to reject the code? I'm on vacation and can't program until I get back.

I am developing an application in Swift. I am currently working on an information screen (legal notices, loans, documentation, etc.) that will be presented on the main screen.

The expected behavior is that when you click the Reject Triggers button in InfoViewController, the Modal Viewer is rejected.

Here is the code I'm trying to use:

//This is InfoViewController, the swift file used to conorol the info screen.

import UIKit

class InfoViewController: UIViewController {

    @IBAction func Dismiss(sender: AnyObject) {
        self.dismissViewControllerAnimated(true, completion: {});//This is intended to dismiss the Info sceen.
        println("pressed")
    }
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

}

      

Here is the storyboard layout:

postimg.org/image/wbozsmtr3/

When I click the button, the app crashes and doesn't dismiss the modal view controller.

It compiles, assuming it is not a syntax error.

Here is the output from the LLVM debugger: 2014-08-30 20:02:20.571 CryptoCalc[799:244086] 17545849:_UIScreenEdgePanRecognizerEdgeSettings.edgeRegionSize=13.000000 //Unrelated stuff deleted. 2014-08-30 20:03:03.756 CryptoCalc[799:244086] Unknown class InfoViewController in Interface Builder file. 2014-08-30 20:03:20.485 CryptoCalc[799:244086] -[UIViewController Dismiss:]: unrecognized selector sent to instance 0x14d57990 2014-08-30 20:03:20.489 CryptoCalc[799:244086] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController Dismiss:]: unrecognized selector sent to instance 0x14d57990' *** First throw call stack: (0x2238be2f 0x2f46bc8b 0x22391179 0x2238f097 0x222c11f8 0x259b9fef 0x259b9f91 0x259a4d13 0x259b99fd 0x259b96d7 0x259b2fa1 0x25989a09 0x25bfbae3 0x259884a1 0x2235257f 0x2235198f 0x2234fff5 0x2229e611 0x2229e423 0x297f80a9 0x259e8485 0x73720 0x7375c 0x2f9f1aaf) libc++abi.dylib: terminating with uncaught exception of type NSException

If you need more information, let me know. Many thanks.

+3


source to share


1 answer


The main problem here is Unknown class InfoViewController in Interface Builder file.

You need to make sure that (under "Custom Class")

1) Class in storyboard is set to InfoViewController



2) The module is set to "Current - your project name"

a screenshot is shown to show which part of the interface constructor I mean

enter image description here

+3


source







All Articles