How to create and get return Value from Cocoa Dialog?

前端 未结 4 1112
抹茶落季
抹茶落季 2020-12-13 15:46

In my application, I want to create a dialog box with one text field, and a button, through which I can prompt user and get back user entered value.

How do I do this

4条回答
  •  醉话见心
    2020-12-13 16:29

    I believe what you are looking for is a sheet. Have a look at the Sheet Programming Topics documentation

    I've just updated a Github Sample project on this. You can enter text in a field on the sheet and pass that back to the main window.

    This example shows how to create a view in a nib and use a custom sheet controller class which uses a block as the callback, rather than having to create and pass in a selector.

提交回复
热议问题