【发布时间】:2013-01-29 01:17:36
【问题描述】:
从屏幕上删除等待视图时,我的应用程序崩溃了一段时间。请指导我如何改进下面给出的代码。
仅当应用程序从服务器下载内容时才会调用等待视图。当它完成下载然后我调用 removeWaitView 方法。
异常类型:NSGenericException
原因:集合在枚举时发生了变异。
+(void) removeWaitView:(UIView *) view{
NSLog(@"Shared->removeWaitView:");
UIView *temp=nil;
temp=[view viewWithTag:kWaitViewTag];
if (temp!=nil) {
[temp removeFromSuperview];
}
}
我的waitview添加代码是
+(void) showWaitViewInView:(UIView *)view withText:(NSString *)text{
NSLog(@"Shared->showWaitViewWithtag");
UIView *temp=nil;
temp=[view viewWithTag:kWaitViewTag];
if (temp!=nil)
{
return;
}
//width 110 height 40
WaitViewByIqbal *waitView=[[WaitViewByIqbal alloc] initWithFrame:CGRectMake(0,0,90,35)];
waitView.center=CGPointMake(view.frame.size.width/2,(view.frame.size. height/2) -15);
waitView.tag=kWaitViewTag; // waitView.waitLabel.text=text;
[view addSubview:waitView];
[waitView release];
}
【问题讨论】:
-
查看异常的完整回溯会很有用。 (如果您不确定如何找到这些信息,您可以 Google 搜索一下。)
-
removeWaitView怎么叫?
标签: iphone ios objective-c