开发者

IBOutlets are always nil

开发者 https://www.devze.com 2023-01-01 15:56 出处:网络
I added an object to my .nib and I connected IBOutlets to it. But the object doesn\'t initiate the .nib. Another object does that. When I initiate the object added to my .nib (from somewhere in my cod

I added an object to my .nib and I connected IBOutlets to it. But the object doesn't initiate the .nib. Another object does that. When I initiate the object added to my .nib (from somewhere in my code), then all IBOutlets are nil, even if the nib has been loaded.

What am I doing wrong he开发者_如何学JAVAre.


You don't need to do that. If you initiate an instance of the same class as the object you added to the nib, you now have 2 of them. The instance that you initiated doesn't have any IBOutlets connected. The instance in the nib has connected outlets.

Make sense?

0

精彩评论

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