當啟動小程式時,如小程式未下載到裝置,小程式容器會啟動載入頁(如下圖)提示使用者等待,待小程式安裝到裝置上,載入頁關閉並跳轉至小程式。

實現自訂載入頁
對於 iOS 小程式,mPaaS 支援開發人員自訂載入頁內容,您可按照以下步驟進行配置:
繼承
APBaseLoadingView的子類,自訂載入頁 View 子類,您可以在子類中修改頁面 view 的樣式。

程式碼範例如下:
@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]; // 調整 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在
DTFrameworkInterface類的 category 中,重寫baseloadViewClass方法,返回自訂的載入頁 View 類名。- (NSString *)baseloadViewClass { return @"MPBaseLoadingView"; }