Search code examples
iosswiftbuttonuikitalert

I can't display alert when I pressed my recalculate button


I designed an app in iOS. I have 2 viewcontroller and in secondview there is a button to press recalculate. I want to show alert message to ask "Are you sure to recalculate" or something like that. Even if I did if condition, ios didnt show me alert message secondview

This is my storyboard

enter image description here

I try to show my alert message but when I pressed my button pass primary page


Solution

  • Your RootViewController should start with a UINavigationController, And each segue way should have its own Identifier.

    In this link you can check it step by step: https://vasundhara.io/blogs/navigate-from-one-view-controller-to-another-using-swift

    I think your issue is for not having a UINavigationController.