How to combine UIScrollview with UIPagecontrol to show different views?

前端 未结 4 1316
刺人心
刺人心 2021-02-06 14:59

I\'ve searched and searched for a tutorial for this but none of them are what I\'m looking for. I\'ve tried Apple\'s sample but it is just colors and I don\'t know how to make i

4条回答
  •  野性不改
    2021-02-06 15:50

    // Adding UIView to PageControl example

      - (id)initWithPageNumber:(int)page {
            UIScreen *screen = [UIScreen mainScreen];
            CGRect frame = [screen applicationFrame];
            frame.origin.y=0;
    
            if (self = [super initWithNibName:@"MyView" bundle:nil]) {      
                    UIView *view = [[UIView alloc] initWithFrame:frame];
    
                    [self.view addSubview:view];
    
                                // Add whatever you want to the view here.
                    [view release];
                pageNumber = page;
            }
            return self;
        }
    

提交回复
热议问题