तो मैं जबकि जोड़ने और झांकना कैलेंडर ऐप की तरह ज्यादा कोशिकाओं को हटाने में कोई ओरिगेमी प्रकार कागज गुना अनुकरण करने के लिए कोशिश कर रहा हूँ कागज गुना अनुकरण करने के लिए कैसे: जबकि डालने और एक UITableView में पंक्तियों को हटाने
मैं बहुत के करीब मिल गया है UITableView subclassing और insertRowsAtIndexPaths को ओवरराइड करके यह कार्यक्षमता: RowAnimation: और DeleteRowsAtIndexPaths: withRowAnimation:
हालांकि अभी मैं एनीमेशन को सही दिखने वाला प्रतीत नहीं कर रहा हूं। नीचे मेरा वर्तमान कोड है - मैं सिर्फ इस आखिरी बाधा को पाने में मदद करना चाहता हूं (या शायद एक पूरी तरह से अलग दृष्टिकोण है जैसे टेबलव्यूसेल में टेबलव्यू जोड़ना)।
- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths
withRowAnimation:(UITableViewRowAnimation)animation
{
[super insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
float duration = .30;
int i = 0;
for (NSIndexPath *indexPath in indexPaths) {
__block UITableViewCell *cell = [super cellForRowAtIndexPath:indexPath];
if (cell) { // If indexPath isn't visible we'll get nil here
//even cells flip up while odd cells flip down
if(i % 2 ==0){
cell.layer.anchorPoint = CGPointMake(.5, 0);
//start row off by rotating 90 degrees
__block CATransform3D t = CATransform3DIdentity;
t = CATransform3DTranslate(t, 0, -cell.bounds.size.height/2, 0);
t = CATransform3DRotate(t, hn_radians(90), 1, 0, 0);
t.m34 = -1.0/(cell.layer.bounds.size.height * 4.6666667);
cell.layer.transform = t;
//flip up
[UIView animateWithDuration:duration delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
t = CATransform3DIdentity;
t = CATransform3DTranslate(t, 0, -cell.bounds.size.height/2, 0);
cell.layer.transform = t;
NSLog(@"");
} completion:^(BOOL finished) {
cell.layer.transform = CATransform3DIdentity;
cell.layer.anchorPoint = CGPointMake(.5, .5);
}];
}
else{
cell.contentView.layer.anchorPoint = CGPointMake(.5, 1);
//start row off by rotating 90 degrees
__block CATransform3D t = CATransform3DIdentity;
t = CATransform3DTranslate(t, 0, -cell.contentView.bounds.size.height * 0.5f, 0);
t = CATransform3DRotate(t, hn_radians(-90), 1, 0, 0);
t.m34 = -1/500.f;
cell.contentView.layer.transform = t;
//flip down
[UIView animateWithDuration:duration delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
t = CATransform3DIdentity;
t = CATransform3DTranslate(t, 0, cell.contentView.bounds.size.height * 0.5f, 0);
cell.contentView.layer.transform = t;
} completion:^(BOOL finished) {
//reset anchor and transform
cell.contentView.layer.transform = CATransform3DIdentity;
cell.contentView.layer.anchorPoint = CGPointMake(.5, .5);
}];
}
i++;
}
}
}
https://github.com/mpospese/MPFoldTransition –
मैंने पहले ही इस परियोजना को चेक कर लिया है - जो मैं चाहता हूं वह नहीं करता है। यह एक दृश्य से दूसरे में एक एकल गुना संक्रमण के लिए अच्छा है, लेकिन तालिकादृश्य में पंक्तियों को जोड़ने/हटाने के लिए नहीं, और एकाधिक गुना का समर्थन नहीं करता है। – MweyaMutsvene
https://github.com/honcheng/PaperFold-for-iOS इसे एक बार आज़माएं। –