ios - Ambiguous use of 'dismiss()' on UIButton when converting to swift 3.0 -


i have programmatically created uibutton in swift 2.0 named nobtn, signifies dismissal of uiviewcontroller. when user clicks button, view controller containing button dismisses. when converted swift 3.0 kept getting error:

  • ambiguous use of 'dismiss()'

i tried adding arguments dismiss() didn't work. here original code without arguments.

nobtn.addtarget(self, action: #selector(setupnameviewcontroller.dismiss), for: uicontrolevents.touchupinside) 

rewrite this. first, give same class dismiss method:

func dismiss() {     self.dismiss(animated:true) } 

second, change selector #selector(dismiss).

now selector call dismiss function call dismiss(animated:completion:) trying do.


Comments

Popular posts from this blog

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - SSE Emitter : Manage timeouts and complete() -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -