开发者

Interface Builder won't connect button, but the tutorial says it should work

I've been trying to learn Core Data, and browsing through questions on Stack Overflow lead me to a recommendation that I try the tutorial on Core Data over at Cocoa Dev Central (Link).

Everything is making sense so far in the tutorial, but when I got to step 16, it wouldn't let me connect the + button to the Posts array controller. I've gone back and double, triple-checked each step along the way and can't see where anything is off, but it still won't let me connect. I'm using the latest versions of Xcode and Interface Builder (just re-downloaded them last week); could this be a version compatibility issue?

Addendum

Seems that the problem was in that I had to change the name by changing the class in the inspector, and that removed the default actions for the array controller. Changing the class back to NSArrayController restores functionality, but now it appears as "Array Controller" wherever it appears, which seems like it'd become problematic with 3 controllers in play once I fix the Authors and Top开发者_如何转开发ics controllers.


Got it. Under the inspector, use "Name" to change the name of the object, not "Class". Newbie error.


Based on your comments, you changed the class of the Posts controller from an NSArrayController to a custom class called Posts. Interface builder couldn't find an implementation for this custom class, hence, did not show any actions or outlets available to bind against.

Changing the class back to NSArrayController fixed the problem.

(Interface builder lets you do this as you may want to define your own custom controller. You can add the actions and outlets to the object in IB, then generate the class and add the implementation in XCode. This is quite useful - but can confuse new users of the tool.)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜