2

画面の上部から、UIViewController に含まれる UIView で手動でアニメーション化しようとしています。このビューの高さは 150px です。

「折りたたまれた」ときと「展開された」ときのレイアウト制約を設定します(表示)。非表示/表示する場合は、2 つの制約の間でそれぞれアニメーション化します。

この UIViewController に含まれるビューを IB でセットアップし、ビューの左上に単純な UILabel を配置します。

CGFloat closeUpViewHeight = 150.f;
self.closeUpViewController = [[[CloseUpViewController_Phone alloc] initWithNibName:@"CloseUpViewController_Phone"
                                                                           bundle:nil]
                              autorelease];

[self addChildViewController:self.closeUpViewController];
[self.view addSubview:self.closeUpViewController.view];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.closeUpViewController.view
                                                      attribute:NSLayoutAttributeHeight
                                                      relatedBy:NSLayoutRelationEqual
                                                         toItem:nil
                                                      attribute:NSLayoutAttributeHeight
                                                     multiplier:0.f
                                                       constant:closeUpViewHeight]];

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.closeUpViewController.view
                                                      attribute:NSLayoutAttributeWidth
                                                      relatedBy:NSLayoutRelationEqual
                                                         toItem:self.view
                                                      attribute:NSLayoutAttributeWidth
                                                     multiplier:1.f
                                                       constant:0.f]];

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.closeUpViewController.view
                                                      attribute:NSLayoutAttributeCenterX
                                                      relatedBy:NSLayoutRelationEqual
                                                         toItem:self.view
                                                      attribute:NSLayoutAttributeCenterX
                                                     multiplier:1.f
                                                       constant:0.f]];

self.expandedCloseUpViewConstraint = [NSLayoutConstraint constraintWithItem:self.closeUpViewController.view
                                                                  attribute:NSLayoutAttributeTop
                                                                  relatedBy:NSLayoutRelationEqual
                                                                     toItem:self.view
                                                                  attribute:NSLayoutAttributeTop
                                                                 multiplier:0.f
                                                                   constant:0.f];

self.collapsedCloseUpViewConstraint = [NSLayoutConstraint constraintWithItem:self.closeUpViewController.view
                                                                   attribute:NSLayoutAttributeBottom
                                                                   relatedBy:NSLayoutRelationEqual
                                                                      toItem:self.view
                                                                   attribute:NSLayoutAttributeTop
                                                                  multiplier:1.f
                                                                    constant:-1.f]; 

結果の UILabel にエイリアシングの問題がある理由を知っている人はいますか?

ここに画像の説明を入力

4

1 に答える 1

1

私の問題を修正しました。かなりばかげた間違いです。

私のView Controllerのセットアップ内で、UIViewにドロップシャドウを追加しましたが、誤ってこれを引き継いでしまいました:

self.view.layer.masksToBounds = NO;
self.view.layer.shadowOffset = CGSizeMake(0, 2);
self.view.layer.shadowRadius = 3;
self.view.layer.shadowOpacity = 0.8;
self.view.layer.shouldRasterize = YES;  //<--- Don't rasterize.

行を削除するとshouldRasterize、ここで問題が修正されます。

于 2012-12-17T17:50:23.983 に答える