0

カスタム画像を表示するようにカスタムUINavigationBarをカスタマイズしました(実際には、NSTimer上の多数の画像間でクロスフェードします):

- (void) displayImage:(EGOImageView*)anImageView {
    CABasicAnimation *crossFade = [CABasicAnimation animationWithKeyPath:@"contents"];
    crossFade.duration = 0.5;
    crossFade.fromValue = self.layer.contents;
    crossFade.toValue = (id)[self imageFromView:anImageView].CGImage;
    [self.layer addAnimation:crossFade forKey:@"animateContents"];
    self.layer.contents = (id)[self imageFromView:anImageView].CGImage;
}

barButtonItemを有効または無効にするときに、navigationBarがカスタムレイヤーを失うのを防ぐにはどうすればよいですか?VCの次の行が実行されると、ナビゲーションバーはデフォルトの状態に戻ります。

self.navigationItem.rightBarButtonItem.enabled = !editing;

(VCのviewDidLoadで設定したUIBarStyleBlackOpaqueに戻ります)

4

1 に答える 1

1

When I was working on a custom NavBar i found this useful How do iPhone apps Instagram/Reeder/DailyBooth implement custom NavigationBars with variable width back buttons?

It goes across how to make a custom NavBar, and then later on talks about a past post, about to make a custom back button. Which is a full post which can be found here. I personally found these useful in my current project. Hopefully this will either explain why it's happening for your method, or give you an alternative method to use, if you can't find a solution for your current method of using crossFade and NSTimer

于 2011-02-05T11:48:20.603 に答える