我按照此处的指南弹出我自己的自定义视图,以指示我正在搜索用户结果: http://joris.kluivers.nl/blog/2012/03/02/custom-popups-revisited/
找到搜索结果后,我会关闭自定义视图,立即弹出一个Flurry广告。我点击广告上的x按钮,然后会显示下一个视图。此视图不再接收任何触摸事件,底部的标签栏也不起作用。我怀疑它必须做一些自定义视图仍然动画(通过转换为0.0f)Flurry广告即将到来,但我不确定。我包含了如何创建微调器以及解雇的代码。
注意:我已经确认问题与Flurry Ads在我的customSpinner消失时以模态方式显示有关。我不知道如何修复它。当我不显示广告时,触摸事件就会正常显示。
PCFFinder.c
- (void)queryServer:(NSString *)queryString {
__block PCFCustomSpinner *spinner = [[PCFCustomSpinner alloc] initWithFrame:CGRectMake(0, 0, 200, 200):@"Searching.."];
[spinner show];
NSString *url = @"https://selfservice.mypurdue.purdue.edu/prod/bwckschd.p_get_crse_unsec";
NSString *referer = @"https://selfservice.mypurdue.purdue.edu/prod/bwckgens.p_proc_term_date";
dispatch_queue_t task = dispatch_queue_create("Task 3", nil);
dispatch_async(task, ^{
NSString *webData = [PCFWebModel queryServer:url connectionType:@"POST" referer:referer arguements:queryString];
if (webData) {
classesOffered = [PCFWebModel parseData:webData type:2];
dispatch_async(dispatch_get_main_queue(), ^{
[spinner dismiss];
spinner = NULL;
if ([classesOffered count] > 0) {
if (self.view.window)
searching = NO;
//the ad pops up in the next view controllers viewWillAppear method and after exiting the ad, the views no longer work
[self performSegueWithIdentifier:@"ChooseClass" sender:self];
}else {
[spinner dismiss];
PCFCustomAlertView *alert = [[PCFCustomAlertView alloc] initAlertView:CGRectMake(0, 0, 300, 200) :@"Search Results" :@"No results were found. Please try broadening the search or double check your input." :@"OK"];
[alert show];
//the views still work here though..
searching = NO;
}
});
//rest omitted because it is irrelevant.
}
CustomPopup.c
-(void)dismiss
{
__block UIWindow *animatedWindow = self.window;
[UIView animateWithDuration:0.3f delay:0.0f options:UIViewAnimationCurveEaseOut animations:^{
animatedWindow.transform = CGAffineTransformMakeScale(0.0f, 0.0f);
}completion:^(BOOL finished) {
animatedWindow.hidden = YES;
animatedWindow = nil;
}];
}
-(void)show
{
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.windowLevel = UIWindowLevelAlert;
self.window.backgroundColor = [UIColor clearColor];
self.center = CGPointMake(CGRectGetMidX(self.window.bounds), CGRectGetMidY(self.window.bounds));
[self.window addSubview:self];
[self.window makeKeyAndVisible];
//animated
self.window.transform = CGAffineTransformMakeScale(1.5f, 1.5f);
self.window.alpha = 0.0f;
__block UIWindow *animationWindow = self.window;
[UIView animateWithDuration:0.3f delay:0 options:UIViewAnimationCurveEaseIn animations:^{
animationWindow.transform = CGAffineTransformMakeScale(1.0f, 1.0f);
animationWindow.alpha = 1.0f;
}completion:nil];
}
我已尝试在viewWillAppear方法中将视图设置为第一响应者,但这也不起作用。
答案 0 :(得分:0)
在您的dismiss方法中,您将单个窗口设置为零刻度并隐藏。这肯定是你的问题。为弹出窗口视图设置动画,然后将其从超级视图中删除。