• 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];
    }

  • 相关阅读:
    Title标题及Description描述字数
    网站优化十忌
    link和domain的区别
    什么是回合制游戏
    人文社科核心、中文核心、北大核心期刊
    锚文本
    笔记本声音尖叫的问题
    Educational Technology Journals(转)
    配置SharePoint门户网站的基本思路
    SEO 如何优化单个页面16招
  • 原文地址:https://www.cnblogs.com/lisa090818/p/3504549.html
Copyright © 2020-2023  润新知