小编LUI*_*LUI的帖子

App崩溃说集合表达式类型UIView*'可能无法响应'countByEnumeratingWithState:object:count"'

我有一个UIImageViewtableView内部,并希望在单击该行时以编程方式删除它.

   -(void) tableView:(UITableView *) tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {

            for (UIView *subview in  tableView)
            {
                if([subview isKindOfClass:[UIImageView class]])
                {
                 [subview removeFromSuperview];
                }
            }
}
Run Code Online (Sandbox Code Playgroud)

当我点击表格行时,应用程序崩溃了.Warning : Collection expression type UIView* may not respond to countByEnumeratingWithState:object:count" 应用程序崩溃提供相同的消息.我错过了什么?我只粘贴了相关的代码部分.

iphone objective-c uitableview uiview ios

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

无法显示活动指示器iOS

我想UIActivityIndicatorviewDidLoad屏幕上显示.它在另一个项目中工作,但不知道为什么它不会在这里显示.

我从viewDidLoad其他屏幕调用showSplashScreen .

+(void) showSplashScreen
{
    UIView *mainScreen = [[[UIApplication sharedApplication]delegate]window];

    UIView *windowBlocker = [[UIView alloc]initWithFrame:mainScreen.frame];
    windowBlocker.tag = 999;
    windowBlocker.backgroundColor = [UIColor clearColor];

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake((mainScreen.frame.size.width), (mainScreen.frame.size.height), 50, 50)];
    imageView.layer.backgroundColor=[[UIColor colorWithRed:200 green:0 blue:0 alpha:0.5] CGColor];

    imageView.layer.cornerRadius=10;
    imageView.layer.masksToBounds = YES;
    [windowBlocker addSubview:imageView];

    UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    [windowBlocker addSubview:spinner];
    spinner.center = mainScreen.center;
    [spinner startAnimating];
}
Run Code Online (Sandbox Code Playgroud)

什么都没发生.任何的想法?我正在尝试iPad.

iphone objective-c ios

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

标签 统计

ios ×2

iphone ×2

objective-c ×2

uitableview ×1

uiview ×1