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:
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.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
In the category of the
DTFrameworkInterface
class, override thebaseloadViewClass
method to return the custom load page View class name.- (NSString *)baseloadViewClass { return @"MPBaseLoadingView"; }