iOS 库,允许获取远程编译和压缩的 .xib 文件,并从获取的 .xibs 中加载 UIViewControllers
FBRemoteNibLoader 允许您获取 NIB 文件的新版本,而无需更新 AppStore 中的应用程序
此库不包含任何编译后的源代码,因此它应符合苹果的指南。
// Load a view controller using FBRemoteNibLoader, instead of initWithNibName.
// If such nib has not been cached yet, it will user the original .xib file
UIViewController * vc = [[FBRemoteNibLoader sharedController] viewControllerWithNibName:@"ViewControllerClassName"];
[self presentViewController:vc
animated:YES
completion:^{
NSLog(@"Presented view controller");
}];
// In order to load a remote .zip file
NSURL * url = [NSURL URLWithString:@"https:///nibs.zip"];
[[FBRemoteNibLoader sharedController] loadRemoteNibsFrom:url
completion:^(BOOL success) {
NSLog(@"Success? %@", @(success));
}];
// You can clear the cache, to use the original .xib files included in the file.
[[FBRemoteNibLoader sharedController] clearCache];
file.zip
要创建 .xib.bin 文件,请使用以下命令
ibtool original.xib --compile original.xib.bin
打开所提供的 XCode 项目(记得获取一些 pods:pod install)。
运行一次。如果您在点击“显示弹出层”之前点击“加载远程 nibs”,您将使用原始 .xib 文件。
当您点击“加载远程 nibs”时,FBRemoteNibLoader 将从应用程序的文档目录中提取.url和拆解它。
然后,“显示弹出层”将使用从 zip 中提取的缓存的 .xib 文件,加载。
这是我将来想包括的功能
Felipe Baytelman,[email protected]
FBRemoteNibLoader 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE 文件。