• send to instance already dealloc nil error


    这个是因为发送消息的对象已经被dealloc了,然后再次发送[release]请求就不行了。所以可以retain或者alloc对象

    if (self.buttonsList) {
            
            for (int index = 0; index < 9; index ++) {
                
                UIButton *button = [[UIButton alloc]init];
                button.backgroundColor = [UIColor blueColor];
                button.tag = index;
                if (cellOffsetx >= (self.bgscrollview.frame.size.width - 5.0f)) {
                    
                    //new line
                    ++scrollviewLineNumber;
                    cellOffsetx = 5.0f;
                }
                
                button.frame = CGRectMake(cellOffsetx, cellHeight*scrollviewLineNumber + cellOffsety*scrollviewLineNumber + cellOffsety,cellWidth, cellHeight);
                cellOffsetx = cellOffsetx + cellWidth + 5.0f;
                
                //store the button
                [self.buttonsList addObject:button];
                //[self.bgscrollview addSubview:[self.buttonsList objectAtIndex:index]];
                [button release];

            }
          
        }

    - (void)dealloc
    {
     
        self.bgscrollview.delegate = nil;
        [_buttonsList release];  //不使用alloc的话会crash
        _buttonsList = nil;
        [_entriesArray release];
        _entriesArray = nil;
        [_alertView release];
        _alertView = nil;
        [_albumTitle release];
        _albumTitle = nil;
        [_bgscrollview release];
        _bgscrollview = nil;
        [_photosList release];
        _photosList = nil;
        [_customNav release];
        _customNav = nil;
        [_localView release];
        _localView = nil;
        [super dealloc];
    }

  • 相关阅读:
    jenkins--部署项目
    jenkins--创建项目
    jenkins--安全配置
    jenkins--工具配置
    jenkins--系统配置
    11.17
    11.14
    11.13
    dfs
    10.31
  • 原文地址:https://www.cnblogs.com/lisa090818/p/3504549.html
Copyright © 2020-2023  润新知