我试图为我的一个观点设置.alpha
参数的动画。下面是一段代码:
- (IBAction)closeImg:(id)sender
{
[UIView animateWithDuration:0.25 animations:^ {
imgViewList.alpha = 0.0;
[self.navigationController setToolbarHidden:NO animated:NO];
self.navigationController.toolbar.barTintColor = nil;
self.navigationController.toolbar.clipsToBounds = NO;
NSMutableArray *toolbarButtons = [self.toolbarItems mutableCopy];
[toolbarButtons removeObject:self.editButton];
[toolbarButtons removeObject:self.spaceBar];
[toolbarButtons removeObject:self.deleteImgButton];
[toolbarButtons removeObject:self.closeButton];
[toolbarButtons removeObject:self.shareBtn];
[toolbarButtons removeObject:self.dismiss2];
[toolbarButtons removeObject:self.upload2];
[toolbarButtons addObject:self.backBtn];
if (![[[NSUserDefaults standardUserDefaults] valueForKey:@"imageToDisplay"] isEqualToString:@"newsImg"]) {
[toolbarButtons addObject:self.spaceBar];
[toolbarButtons addObject:self.menuBtn];
}
[self setToolbarItems:toolbarButtons animated:YES];
self.view.window.windowLevel = UIWindowLevelNormal;
[imgUpload removeAllObjects];
pgScroll.contentSize = CGSizeMake(pgScroll.frame.size.width, imgList.frame.origin.y+imgList.frame.size.height+20);
pgScroll.contentInset = contentInsets;
pgScroll.scrollIndicatorInsets = contentInsets;
}
}
它每隔一段时间(每隔4或5次)就会起作用,但它并不适用。 imgViewList
并没有消失。 偶尔会发生什么?因为它通常会一直有效,或者它没有。或者该代码的其他部分可能产生负面影响?