在iOS 9中打破了方向

时间:2015-10-07 12:10:48

标签: objective-c iphone ios9 xcode7 uiinterfaceorientation

我开发了一款支持#include<iostream> #include<opencv2/highgui/highgui.hpp> #include<opencv2/imgproc/imgproc.hpp> using namespace std; using namespace cv; int main(){ Mat src = imread("7.png",1); imshow("src",src); src = src + Scalar (75,75,75); Mat erosion_dst; Mat dilation_dst; Mat dilation_dst1; int erosion_size = 8; cv::Mat element = cv::getStructuringElement(cv::MORPH_CROSS, cv::Size(2 * erosion_size + 1, 2 * erosion_size + 1), cv::Point(erosion_size, erosion_size) ); erode( src, erosion_dst, element ); erode( erosion_dst, erosion_dst, element ); erode( erosion_dst, erosion_dst, element ); dilate(erosion_dst, dilation_dst1, element ); dilate(dilation_dst1, dilation_dst, element ); dilate(dilation_dst, dilation_dst, element ); dilate(dilation_dst, dilation_dst, element ); erode( dilation_dst, dilation_dst, element ); imshow("opening of image",dilation_dst); Mat topHat= src-dilation_dst; //topHat = topHat + 255; imshow("tophat image",topHat); for(int i=0;i<topHat.rows;i++) { for(int j=0;j<topHat.cols;j++) { if(topHat.at<uchar>(i,j) > 2 ) { //originalImage.at<Vec3b>(i,j) = 255; topHat.at<uchar>(i,j)=255; // cout << i<<" " <<j<< endl; } } } // imshow("Final image",topHat); waitKey(); } 的iOS应用。直到if ([[[NEVPNManager sharedManager] connection] status] == NEVPNStatusInvalid) { //... } 它根据Orientation更改在iOS 8.4方法中为我提供了正确的视图大小(宽度和高度)。但是,现在我使用viewWillAppearOrientation中运行现有应用,然后Xcode 7因视图大小不正确而导致iOS 9显示不正确,如果您在Orientation方法中显示它。我通过viewWillAppear方法更新帧的所有控制器,但现在它不起作用。有没有其他解决方案来实现它。我使用的viewWillAppear未启用Xib。请帮帮我。

1 个答案:

答案 0 :(得分:1)

发生了一件非常类似的事情,我在谷歌上搜索答案时偶然发现了这个问题。 我的问题是因为自定义UIViewControllerAnimatedTransitioning实现无法为新视图分配正确的框架。

- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
    UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
    UIView *toView = toVC.view;
    toView.frame = [transitionContext finalFrameForViewController:toVC];
    // transition animation goes here...
}

我不知道为什么,但是直到iOS 9,如果没有这条线就没有问题。

希望有所帮助