小编Pat*_*eux的帖子

transitionWithView和animateWithDuration的问题

我有问题transitionWithViewanimateWithDuration.我的一个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)

这是我的一个容器视图控制器.动画似乎没有任何效果的文本productTitleLabelproductDescriptionTextView突然改变,仿佛动画块不存在.

- (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)

iphone xcode uianimation ipad ios

7
推荐指数
1
解决办法
7531
查看次数

在Storyboard中创建的容器视图不会以编程方式更改框架

我有一个容器视图,@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)

我知道这是基本的,它之前对我有用,当我以编程方式创建对象时,但它现在对我不起作用.

xcode containers uiviewcontroller uiview ios

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

ios ×2

xcode ×2

containers ×1

ipad ×1

iphone ×1

uianimation ×1

uiview ×1

uiviewcontroller ×1