我有一个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"
应用程序崩溃提供相同的消息.我错过了什么?我只粘贴了相关的代码部分.
我想UIActivityIndicator在viewDidLoad屏幕上显示.它在另一个项目中工作,但不知道为什么它不会在这里显示.
我从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.