All Products
Search
Document Center

Customize startup loading page of iOS Mini Program

Last Updated: Feb 05, 2021

When the Mini Program is started, if the Mini Program has not been downloaded to the device, the Mini Program container will launch the loading page (as shown in the image below) to prompt the user to wait. After the Mini Program is installed on the device, the loading page will be closed and the page will jump to the Mini Program.

启动加载项

Implement a custom loading page

For iOS Mini Program, mPaaS supports developers to customize the content of the loading page. You can configure it according to the following steps:

  1. Inherit the subclass of APBaseLoadingView and customize the View subclass of the loading page. You can modify the style of the page view in the subclass.

    subclass

    The code sample is as follows:

    1. @interface MPBaseLoadingView : APBaseLoadingView
    2. @end
    3. @implementation MPBaseLoadingView
    4. - (instancetype)init
    5. {
    6. self = [super init];
    7. if (self) {
    8. self.backgroundColor = [UIColor grayColor];
    9. self.titleLabel.backgroundColor = [UIColor redColor];
    10. self.titleLabel.font = [UIFont boldSystemFontOfSize:8];
    11. self.iconImageView.backgroundColor = [UIColor blueColor];
    12. self.pageControl.backgroundColor = [UIColor orangeColor];
    13. }
    14. return self;
    15. }
    16. - (void)layoutSubviews
    17. {
    18. [super layoutSubviews];
    19. // Adjust the position of the view
    20. CGSize size = self.bounds.size;
    21. CGRect frame = CGRectMake((size.width - 80)/2, 0, 80, 80);
    22. self.iconImageView.frame = frame;
    23. frame = CGRectMake(15, CGRectGetMaxY(self.iconImageView.frame) + 6, size.width - 30, 22);
    24. self.titleLabel.frame = frame;
    25. frame = CGRectMake((size.width-40)/2, CGRectGetMaxY(self.titleLabel.frame) + 21, 40, 20);
    26. self.pageControl.frame = frame;
    27. }
    28. @end
  2. In the category of the DTFrameworkInterface class, override the baseloadViewClass method to return the custom load page View class name.

    1. - (NSString *)baseloadViewClass
    2. {
    3. return @"MPBaseLoadingView";
    4. }