小编seb*_*seb的帖子

将非ARC转换为ARC项目而不重新创建它?

我只是想知道是否可以将非ARC项目转换为ARC而不重新创建它?谢谢

ios automatic-ref-counting

18
推荐指数
1
解决办法
9130
查看次数

创建UIImageView时无效的上下文

我尝试创建UIImageView时出错.看看这段代码:

UIImage* backgroundPanel = [[UIImage imageNamed:@"loginPanelBackground.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(90, 0, 149, 416)];

self.connexionBackgroundImgView = [[UIImageView alloc] initWithImage:backgroundPanel];
self.connexionBackgroundImgView.frame = CGRectMake(0, 0, 416, 390); // THIS LINE PROVOC THE INVALID CONTEXT
[self.connexionView insertSubview:self.connexionBackgroundImgView aboveSubview:self.connexionToCreationCompteView];
Run Code Online (Sandbox Code Playgroud)

它会在日志中抛出此错误:

<Error>: CGContextSaveGState: invalid context 0x0
<Error>: CGContextSetBlendMode: invalid context 0x0
<Error>: CGContextSetAlpha: invalid context 0x0
<Error>: CGContextTranslateCTM: invalid context 0x0
<Error>: CGContextScaleCTM: invalid context 0x0
<Error>: CGContextGetCTM: invalid context 0x0
<Error>: CGContextSaveGState: invalid context 0x0
<Error>: CGContextClipToRect: invalid context 0x0
<Error>: CGContextDrawTiledImage: invalid context 0x0
<Error>: CGContextRestoreGState: invalid …
Run Code Online (Sandbox Code Playgroud)

uiimageview uiimage cgcontext ios

11
推荐指数
2
解决办法
1万
查看次数

因UIRefreshControl而异常

我第一次使用UIRefreshControl,在加载刷新控件时出现异常.

这里是我的报关表 :

self.refreshControl = [[UIRefreshControl alloc] init];
self.refreshControl.tintColor = [UIColor grayColor];
[self.refreshControl addTarget:self action:@selector(refreshView:) forControlEvents:UIControlEventValueChanged];
[self.actualitesTableView addSubview:self.refreshControl];
Run Code Online (Sandbox Code Playgroud)

这是我的功能:

- (void)refreshView:(UIRefreshControl *)sender {
    [self performSelectorInBackground:@selector(threadAction) withObject:nil];
}

- (void)threadAction {
    [self choixMAJ];
    NSLog(@"OK1");
    [self.refreshControl endRefreshing];
    NSLog(@"OK2");
}
Run Code Online (Sandbox Code Playgroud)

当我使用choixMAJ()方法时,它完美地工作.

一切正常,OK2被记录但在此之后,当刷新控件消失时,应用程序崩溃了这个错误:

*** -[__NSArrayM removeObject:]: message sent to deallocated instance 0x655a1a0
Run Code Online (Sandbox Code Playgroud)

我不明白为什么..有什么想法吗?

ios ios6 uirefreshcontrol

1
推荐指数
1
解决办法
1198
查看次数