On Feb 13, 2015, at 6:49 AM, Uli Kusterer <witness.of.teacht...@gmx.net> wrote:
> On 12 Feb 2015, at 06:36, N!K <pu56ucl...@alumni.purdue.edu> wrote: >> Control-clicking the button in .xib does show the outlet panel but it does >> not list an IBAction, so it cannot connect to the IBAction entered into the >> MyView.h and .m files. Also, control-dragging from the button to MyView (in >> .xib, not in editor) sets up the position constraints. Control-dragging from >> the button to any icon does nothing. > > You mean to File's Owner? Is the “Custom Class" of File's Owner set to the > right class? Yes. > Both right-drag and ctrl-drag still work for me to connect button actions in > 6.1.1 (which is the latest on the MAS). For me, control-dragging does not work with anything except AppDelegate, following Apple’s current example. > >> I haven’t needed a control for quite some time, and I found that things have >> changed in Xcode 6.1.1. I’m attempting to follow Apple’s current >> instruction. >> >> Here’s the instruction from Apple’s Xcode_Overview.pdf, 2014-03-10, pp >> 64-65. The pictures have to be omitted here due to space constraints of this >> forum. >> >> Control-drag from the control in Interface Builder to the implementation >> file. (In the screenshot, the assistant editor displays the implementation >> file of the view controller for the Warrior button.) Xcode indicates where >> you can insert an action method in your code. >> >> [picture shows a line with a leading circle in a space in .m] >> >> Release the Control-drag. The assistant editor displays a Connection menu. >> In this menu, type the name of the action method (chooseWarrior in the >> screenshot below), and click Connect. >> >> [picture shows a menu with space to enter name of action] > > This is for adding a new outlet/action. Which also makes the connection. But following Apple’s current example works only with AppDelegate in my system. > I was under the impression you had an existing one that you just wanted to > hook up? I had also tried entering the IBAction in .h and .m. Initially I failed because I was constrained by what I learned in Hillegas’ 3rd edition. I succeeded when I followed Roland King’s specific directions, which showed me that some of the old constraints no longer apply. Please see my reply to Roland’s email. Nick > >> Connect User Interface Objects to Code >> >> In the implementation file, Xcode inserts a skeletal definition for the new >> method, as shown below. The IBAction return type is a special keyword >> indicating that this instance method can be connected to your storyboard or >> xib file. Xcode also sets the action selector for the control to this >> method. As a result, the method gets invoked whenever the control receives >> an action message. >> >> [picture shows - (IBAction)chooseWarrior:(id)sender { } ] >> >> >> This Xcode_Overview example uses an implementation file, not AppDelegate. It >> does not add an empty object in IB. >> >> Xcode is not allowing connection to my MyView file. Insertion of - >> (IBAction)act:(id)sender { } occurs only in my AppDelegate, which of course >> responds to the button. Clicking the button in the View initiates the >> IBAction, which indicates that I’m following the instruction correctly. I >> do the same steps when I try it with my MyView file, which fails. >> >> Might this be a bug? Or a defective copy of Xcode? Has anyone observed the >> same behavior? > > I'm not sure what you're trying to do. Can you give us a better description? > Your app delegate has an act: method but you're trying to connect to it by > dragging to a MyView? _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com