【问题标题】:How can this code compile? [closed]这段代码如何编译? [关闭]
【发布时间】:2014-06-17 08:59:26
【问题描述】:
    const UIView * vLocalBottomButton = self.BottomButton;

    vLocalBottomButton =nil;

基本上,我想将 self.BottomButton 传递给将在主线程外部运行的方法。使用视图时,将在主线程中完成。

我只需要确保视图不会改变。就这样。所以我把它放到一个局部变量中,然后传递那个局部变量以确保 vLocalBottomButton 没有改变。

【问题讨论】:

    标签: objective-c syntax constants


    【解决方案1】:

    你应该创建常量指针。在你的情况下:

    UIView * const vLocalBottomButton = self.BottomButton;
    
    //this won't compile therefore
    
    vLocalBottomButton =nil;
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-10
    • 1970-01-01
    • 2016-02-22
    • 1970-01-01
    • 2017-10-31
    • 1970-01-01
    • 2013-12-27
    相关资源
    最近更新 更多