• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Wrong type of button in IB?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wrong type of button in IB?


  • Subject: Re: Wrong type of button in IB?
  • From: mmalcolm crawford <email@hidden>
  • Date: Thu, 16 Jun 2005 12:59:21 -0700


On Jun 16, 2005, at 12:34 PM, Julio Cesar Silva dos Santos wrote:

You should declare myButton the way Interface Builder does with every outlet it creates:
IBOutlet id myButton;



Umm, no, this has several faults:

(a) It is *in general* good practice to strongly type outlets (and indeed all variables) so that you can get compiler warnings if you try to send an object inappropriate messages;

(b) Analogous, and more relevant to the current situation: Interface Builder will prevent you from making in incorrect connection;

(c) If you're trying to make an NSButton connection to something that looks like a button, but which Interface Builder informs you is not a button, the correct response is to find out why IB thinks it's not a button, not to ignore what IB's telling you. Or in general to find out what the mismatch is between your code and what IB is doing.


There are many possible issues here:

Firstly, has IB been kept in sync with the header? Simply changing the .h file does not update IB's view of the world. You must re- import the header.

Secondly, what connection are you trying to make? A button or a table view? If a button, then the variable should be declared:

    IBOutlet NSButton *outletName;

If a table view, then:

    IBOutlet NSTableView *outletName;

Once you have that set correctly (and imported the .h file into IB if necessary) then what is actually happening when you try to make the connection?

If you're trying to connect to something that looks like a button, is it actually a button? Does IB provide a tooltip that tells you what you're trying to connect to? **If at some stage you have made a matrix of buttons, but then reduced the matrix down to a single instance, you don't have a button, you have an NSMatrix containing a single NSButtonCell.**

If you're actually trying to connect to a table view, again as you Control-drag are you trying to connect to the right thing? Is the destination the table view, the scroll view that contains the table view, or perhaps a table column?

mmalc

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Wrong type of button in IB? (solved + followup)
      • From: Mark Dawson <email@hidden>
References: 
 >Wrong type of button in IB? (From: Mark Dawson <email@hidden>)
 >Re: Wrong type of button in IB? (From: Andy Lee <email@hidden>)
 >Re: Wrong type of button in IB? (From: Mark Dawson <email@hidden>)
 >Re: Wrong type of button in IB? (From: Julio Cesar Silva dos Santos <email@hidden>)

  • Prev by Date: Re: Still can't figure out this overrelease bug
  • Next by Date: recursing bindings?
  • Previous by thread: Re: Wrong type of button in IB?
  • Next by thread: Re: Wrong type of button in IB? (solved + followup)
  • Index(es):
    • Date
    • Thread