I have problems with transitionWithView
and animateWithDuration
. One of my animateWithDuration
blocks doesn't transition, it is a sudden change, and transitionWithView
does not temporarily disable user interaction. I have checked the docs and believe I am doing everything correctly, but obviously something is wrong. Here are the two blocks of code:
This is in my main View Controller ViewController
which has three container views/child view controllers. This block moves one of the container views, but does not block the user from other interactions in ViewController
while the transition is occurring.
[UIView transitionWithView:self.view duration:0.5 options:UIViewAnimationOptionCurveEaseOut animations:^ {
CGRect frame = _containerView.frame;
frame.origin.y = self.view.frame.size.height - _containerView.frame.size.height;
_containerView.frame = frame;
}completion:^(BOOL finished) {
// do something
}];
This is in one of my container view controllers. The animation seems to have no effect as the text of the productTitleLabel
and productDescriptionTextView
changes suddenly as if the animation block does not exist.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.viewController toggleFlavoredOliveOilsTableView];
if (indexPath.row > 0) {
NSDictionary *selectedCellDict = [[_flavoredOliveOilsDict objectForKey:@"Unflavored Olive Oils"] objectAtIndex:indexPath.row - 1];
[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionTransitionCrossDissolve animations:^ {
self.viewController.productTitleLabel.text = [_flavoredOliveOilsTableView cellForRowAtIndexPath:indexPath].textLabel.text;
self.viewController.productDescriptionTextView.text = [selectedCellDict objectForKey:@"Description"];
}completion:nil];
if (indexPath.row == 1) {
[self.viewController setProductDescriptionTextViewFrameForInformationTab];
}
else {
[self.viewController setProductDescriptionTextViewFrameForNonInformationTab];
//self.viewController.productImageView.image = [UIImage imageNamed:[selectedCellDict objectForKey:@"Image"]];
}
}
}
I think the problems are somewhat related as most of my animation and transition blocks don't work completely as expected. Thanks for any help.
Edit
What I am trying to accomplish is moving a container view in ViewController
and set the text and image properties of a label, text view, and image view; all of which are in the main view. The details of these properties are sent via the child view controller. The transitionWithView
is in a method called toggleFlavoredOiveOilsTableView
which is called in didSelectRowAtIndexPath
. I think the problem is that I am trying to call two different animation/transition blocks at the same time.
transitionWithView
. – Illiquid