//For a custom shadow image to be shown, custom background image must also be set with the setBackgroundImage:forBarMetrics: method. If the default background image is used, then the default shadow image will be used regardless of the value of this property.
UINavigationBar *navigationBar = self.navigationController.navigationBar;
[navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]]
forBarPosition:UIBarPositionAny
barMetrics:UIBarMetricsDefault];