2016-06-28 4 views
1

Implate : 화면 중앙에 다른 컨테이너가있는 경우 컨테이너에 애니메이션을 적용하려고합니다. 그러나 나는 그것을 얻지 못한다. 뷰를 애니메이션으로 만 만들면 navBar는 아무 것도하지 않습니다. 움직이는 경우에는 움직입니다.CGAffineTransformMakeScale을 사용하여 뷰와 해당 네비게이션 막대를 어떻게 애니메이션으로 만들 수 있습니까?

When I only animate the view its look like this

When I animate the navigationBar its look like this

이 내 코드 그것을 해결

let datePickerController = self.storyboard!.instantiateViewControllerWithIdentifier("DatePickerViewController") as! DatePickerViewController 
    let navController = UINavigationController(rootViewController: datePickerController) 
    navController.modalPresentationStyle = UIModalPresentationStyle.Custom 
    navController.transitioningDelegate = self 

    UIView.animateWithDuration(0.3, delay: 0.0, options: UIViewAnimationOptions.CurveEaseInOut, animations: { 
     self.view.alpha = 0.5 
     self.navigationController!.navigationBar.alpha = 0.5 
     self.view.transform = CGAffineTransformMakeScale(0.9, 0.9) 
     //NavigationBar animattion 
     // self.navigationController!.navigationBar.transform = CGAffineTransformMakeScale(0.9, 0.9) 
     self.presentViewController(navController, animated:true, completion: nil) 
    }) { (Bool) in 

    } 

답변

1

이며,이 솔루션이 줄을이

에 의해

self.view.alpha = 0.5 
    self.navigationController!.navigationBar.alpha = 0.5 
    self.view.transform = CGAffineTransformMakeScale(0.9, 0.9) 
    //NavigationBar animattion 
    // self.navigationController!.navigationBar.transform = CGAffineTransformMakeScale(0.9, 0.9) 

을 변경할 수있다

self.navigationController!.view.transform = CGAffineTransformMakeScale(0.93, 0.93) 
    self.navigationController!.view.alpha = 0.5