How can I implement a swiping/sliding animation between views?

后端 未结 3 1178
庸人自扰
庸人自扰 2020-11-30 17:47

I have a few views between which I want to swipe in an iOS program. Right now, I\'m swiping between them using a modal style, with a cross dissolve animation. However, I wan

3条回答
  •  孤独总比滥情好
    2020-11-30 18:46

    If you want the same page scroll/swipe effect as the springboard have when switching page, then why not just use a UIScrollView?

    CGFloat width = 320;
    CGFloat height = 400;
    NSInteger pages = 3;
    
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,width,height)];
    scrollView.contentSize = CGSizeMake(width*pages, height);
    scrollView.pagingEnabled = YES;
    

    And then use UIPageControl to get these dots. :)

提交回复
热议问题