All Products
Search
Document Center

Mobile Platform as a Service:Customize startup loading page of iOS Mini Program

Last Updated:Nov 20, 2024

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.

image

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.

    image

    image

    The code sample is as follows:

     @interface MPBaseLoadingView : APBaseLoadingView
    
     @end
    
     @implementation MPBaseLoadingView
    
     - (instancetype)init
     {
         self = [super init];
         if (self) {
             self.backgroundColor = [UIColor grayColor];
             self.titleLabel.backgroundColor = [UIColor redColor];
             self.titleLabel.font = [UIFont boldSystemFontOfSize:8];
    
             self.iconImageView.backgroundColor = [UIColor blueColor];
    
             self.pageControl.backgroundColor = [UIColor orangeColor];
    
         }
    
         return self;
     }
    
     - (void)layoutSubviews
     {
         [super layoutSubviews];
         // Adjust the position of the view
    
         CGSize size  = self.bounds.size;
         CGRect frame = CGRectMake((size.width - 80)/2, 0, 80, 80);
         self.iconImageView.frame = frame;
    
         frame = CGRectMake(15, CGRectGetMaxY(self.iconImageView.frame) + 6, size.width - 30, 22);
         self.titleLabel.frame = frame;
    
         frame = CGRectMake((size.width-40)/2, CGRectGetMaxY(self.titleLabel.frame) + 21, 40, 20);
         self.pageControl.frame = frame;
     }
    
     @end
  2. In the category of the DTFrameworkInterface class, override the baseloadViewClass method to return the custom load page View class name.

     - (NSString *)baseloadViewClass
     {
         return @"MPBaseLoadingView";
     }