开发者

In Xcode can you add code directly to an interface element?

开发者 https://www.devze.com 2023-01-25 23:51 出处:网络
In VisualBasic, you can add the GUI then click o开发者_如何学Cn an object (Button, label, etc.) and add its code.

In VisualBasic, you can add the GUI then click o开发者_如何学Cn an object (Button, label, etc.) and add its code.

Can I do this in Interface builder?


No. In Interface Builder (IB) and Xcode, you create links between interface elements and controller code via outlets and actions. This isn't as trivially easy as working with VS, but it encourages you to keep your View code and your Controller code separate; it promotes good practices.

The IB User Guide will give you everything you need to know to get started.


You create the GUI in Interface Builder; you write the code in Xcode.

Interface Builder lets you define outlets so that your code can talk to the objects, and action methods so that your interface objects can talk to the code.

See the Cocoa Fundamentals Guide for more precise definitions, and the Interface Builder User Guide for even more specifics.

0

精彩评论

暂无评论...
验证码 换一张
取 消