Why can’t UIImagePickerController be pushed into n

2020-03-01 06:56发布

When using pushViewController to push UIImagePickerController:

[self.navigationController pushViewController:pvc animated:YES];

an error will occur such as:

Pushing a navigation controller is not supported

The right solution is to use presentModalViewController:

[self presentModalViewController:pvc animated:YES];

Can someone explain why this is necessary? What‘s hidden in UIViewController?

Thanks!

1条回答
做自己的国王
2楼-- · 2020-03-01 07:27

Apple does not allow stacking of navigation bars. Since the image picker has its own navigation bar, it cannot be placed in a navigation stack. The result would cause user confusion since there would be two bars, two sets of navigation items, two titles, etc.

查看更多
登录 后发表回答