开发者

Delete outlet references when the control is deleted

Is there anyway to automatically have XCode delete a property or variable when its corresponding contr开发者_运维技巧ol is deleted? For example say I create a button in XCode 4 within a view, then I assign it to a 'new referencing outlet' by doing that ctrl-click hijinks to the source code where I want the property to appear. But then I decide to delete the button. The property will still be in the source code. Why doesn't XCode delete the property?


I would guess it's because deleting the property means deleting all code associated with that property. Xcode doesn't know if you've written some custom setter/getter methods, or if you have extensive amounts of code using that property throughout your project.

Sure, they could use the new fancy clang stuff to analyze your code and delete the property if it's not used anywhere, but I'm guessing that would be too much work.

Also, just because Xcode can generate the property for you, doesn't mean it actually did. In other words, if I created the property myself and hooked it up to the button in IB, do I really want Xcode to delete that code when I delete the button? Probably not.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜