我有问题transitionWithView和animateWithDuration.我的一个animateWithDuration块没有转换,它是一个突然的改变,并transitionWithView没有暂时禁用用户交互.我检查了文档,并相信我正在做的一切正确,但显然有些不对劲.以下是两段代码:
这是在我的主View Controller中ViewController,它有三个容器视图/子视图控制器.此块移动其中一个容器视图,但在ViewController发生转换时不会阻止用户进行其他交互.
[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
}];
Run Code Online (Sandbox Code Playgroud)
这是我的一个容器视图控制器.动画似乎没有任何效果的文本productTitleLabel和productDescriptionTextView突然改变,仿佛动画块不存在.
- (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 = …Run Code Online (Sandbox Code Playgroud) 我有一个容器视图,@property (weak, nonatomic) IBOutlet UIView *containerView;但是当我设置它的框架时它不会移动.以下是我的尝试方式:
- (void)setFramesForCategories
{
CGRect frame = _containerView.frame;
frame.origin.x = 20;
frame.origin.y = self.view.frame.size.height - 52;
frame.size.width = 236;
frame.size.height = 60 * [[_dataDict objectForKey:@"Key"] count];
_containerView.frame = frame;
}
Run Code Online (Sandbox Code Playgroud)
我知道这是基本的,它之前对我有用,当我以编程方式创建对象时,但它现在对我不起作用.