मैं एक बहुत ही सरल संक्रमण करने की कोशिश कर रहा हूं: एक दृश्य बाईं ओर स्क्रीन को आधा स्क्रीन चलाता है जबकि दूसरा ("टू") दृश्य आधे स्क्रीन में चलता है।कस्टम व्यू कंट्रोलर संक्रमण के दौरान फ्लिकरिंग आईओएस 7
मेरे पास एनीमेशन काम कर रहा है, लेकिन जब मैं एनीमेशन को उलट देता हूं, तो मुझे झिलमिलाहट दिखाई देती है। "टू" व्यू (यानी मूल दृश्य) 0,0 की उत्पत्ति पर दिखाई देता है हालांकि मैंने एक अलग फ्रेम सेट किया है।
मैंने दृश्य पदानुक्रम को छोड़ दिया। फ्रेम सही ढंग से सेट किए गए हैं (-100 0; 320 480 देखने के लिए), लेकिन फिर भी यह 0,0 पर दिखाई देता है। एनीमेशन के लिए कहीं कैश किए गए दृश्य का एक स्क्रीनशॉट है?
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
{
UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIView *container = [transitionContext containerView];
CGRect offsetCoverRect = CGRectMake(-100.0, 0.0, 320, 480);
CGRect detailsRect = CGRectMake(-100.0 + 320.0, 0.0, 320, 480);
CGRect detailsOutsideRect = CGRectMake(320.0, 0.0, 320, 480);
CGRect normalRect = CGRectMake(0.0, 0.0, 320, 480);
if (self.revealDetails)
{
toViewController.view.frame = detailsOutsideRect;
[container addSubview:toViewController.view];
}
else
{
[container insertSubview:toViewController.view belowSubview:fromViewController.view];
// reversing… set the frame to the original offset (shows at 0,0 for a moment)
toViewController.view.frame = offsetCoverRect;
}
[UIView animateKeyframesWithDuration:2 delay:0 options:0 animations:^{
if (self.revealDetails)
{
fromViewController.view.frame = offsetCoverRect;
toViewController.view.frame = detailsRect;
}
else
{
fromViewController.view.frame = detailsOutsideRect;
toViewController.view.frame = normalRect;
}
} completion:^(BOOL finished) { [transitionContext completeTransition:finished]; }];
}
अद्यतन:
यह UIModalPresentationCustom
से संबंधित जा रहा है। मुझे इसका उपयोग करने की आवश्यकता है ताकि जब संक्रमण पूरा हो जाए तो दृश्य को हटाया नहीं जाता है। हालांकि, ऐसा लगता है कि रिवर्स संक्रमण के लिए व्यू कंट्रोलर 0,0 से शुरू होता है।
अद्यतन 2:
निम्न कोड के साथ पुन: पेश करने बहुत आसान:
UIView *snapshot = [containerView snapshotViewAfterScreenUpdates:NO];
[containerView addSubview:snapshot];
ऊपर, स्क्रीन पर केंद्रित देखने पर कोई बात नहीं क्या वास्तविक फ्रेम या केंद्र मैं पहले सेट दिखाएगा एनीमेशन।
क्या यह 'UIViewControllerContextTransitioning'' के 'प्रारंभिकफ्रेमफॉरव्यू कंट्रोलर:' से संबंधित है? – Mark
क्या आपको डिवाइस का उपयोग करके या सिम्युलेटर में यह समस्या है? डिवाइस पर – MatterGoal
@MatterGoal भी। ऐसा लगता है कि दृश्य 0,0 पर शुरू होता है इससे कोई फर्क नहीं पड़ता कि मैंने क्या सेट किया है। – Mark