加载本地.json文件 stringWithContentsOfFile NSString *jsonPath = [[NSBundle mainBundle] pathForResource:@"sectionMdl23...error:nil]; NSLog(@"sssssssss%@",JSONString); initWithContentsOfFile NSString *jsonPath = [[NSBundle mainBundle...加载本地.html文件 stringWithContentsOfFile NSString *path = [[NSBundle mainBundle] pathForResource:@"html/start...NSUTF8StringEncoding error:NULL]; NSString *urlStr = [NSString stringWithFormat:@"%@/html",[[NSBundle mainBundle...//本地json - (void)initData { NSString *jsonPath = [[NSBundle mainBundle] pathForResource:@"sectionMdl23
animated{ [super viewDidAppear:animated]; [self setupWebViewController: [[NSBundle mainBundle...pathForResource:KNUserGuideURL ofType:@"html"] ]; // [self setupAXWebViewController: [[NSBundle mainBundle...setupWebViewController:(NSString*)path{ NSURL *baseURL = [NSURL fileURLWithPath:[[NSBundle mainBundle...核心代码 通过文件名获取path [wself setupAXWebViewController: [[NSBundle mainBundle...setupAXWebViewController:(NSString*)path{ NSURL *baseURL = [NSURL fileURLWithPath:[[NSBundle mainBundle
].resourcePath stringByAppendingPathComponent:@"main.bundle"]; NSBundle * mainBundle = [NSBundle bundleWithPath...相对完整代码如下,最终输出的图片尺寸在iPhone上为原始尺寸的1/3,在iPad上为原始尺寸的1/2,正是我们需要的: NSString * bundlePath = [[NSBundle mainBundle...:bundlePath]; NSString * imgPath = [mainBundle pathForResource:@"sample@3x" ofType:@"png"]; UIImage...imgName = [NSString stringWithFormat:@"%@@3x",imgName]; NSString * bundlePath = [[NSBundle mainBundle...:bundlePath]; NSString * imgPath = [mainBundle pathForResource:imgName ofType:@"png"]; UIImage
获取主视图的导航控制器 7 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle...{ 2 3 UIStoryboard *storybaord = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle...8 9 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle...sender { 16 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle...sender { 2 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle
localizedDescription]); }]; 使用AVAsset加载资源: NSURL *assetURL = [[NSBundle mainBundle...default: break; } }]; 获得元数据 NSURL *assetURL = [[NSBundle mainBundle...albumItem = albumMetadata[0]; } }]; 使用AVMetadataItem NSURL *assetURL = [[NSBundle mainBundle
(0, 40, self.view.frame.size.width, self.view.frame.size.height - 20)]; NSString *path = [[NSBundle mainBundle...] bundlePath]; NSURL *baseURL = [NSURL fileURLWithPath:path]; NSString * htmlPath = [[NSBundle mainBundle...0, 0, self.view.frame.size.width, self.view.frame.size.height)]; // NSString *path = [[NSBundle mainBundle...bundlePath]; // NSURL *baseURL = [NSURL fileURLWithPath:path]; // NSString * htmlPath = [[NSBundle mainBundle
mainBundle = [NSBundle mainBundle]; 或者通过Core Foundation来获取,如果你在写一个基于C的APP的话: mainBundle = CFBundleGetMainBundle...(); 通过Path获取Bundles 如果你想访问一个非mainBundle的bundle,那么你可以创建一个合适的bundle对象,如果你知道这个bundel的路径的话。
新建一个继承UIView的类 +(instancetype)photoViewWithPhoto:(Photo *)photo { SYLView *sylView = [[[NSBundle mainBundle...pledge.text = photo.pledge; } 加载 xib方法 xib 编译之后变为 Nib 文件 第一种加载方法 //返回一个数组 NSArry *xibArray = [[NSBundle mainBundle...NSStringFromClass(self) owner:nil options:nil]; 第二中加载方法 /* * 参数 NSString * 是 xib 文件名 * NSBundle * 传入 mainBundle...* 如果传入参数是 mainBundle 则可以传入 nil * */ UINib *nib = [UINib nibWithNibName:
mark下如何获取设备相关的信息 NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; // app名称 NSString...localizedModel]; NSLog(@"国际化区域名称: %@",localPhoneModel ); NSDictionary *infoDictionary = [[NSBundle mainBundle
Version="1.0.0.0" Uri="http://mywebservice.azurewebsites.net/appset.appinstaller" > MainBundle...现在有 appxbundle 和 msixbundle 两个不同的格式,但是这两个格式相同的写法,通过 MainBundle 如下代码。 <?...Version="1.0.0.0" Uri="http://mywebservice.azurewebsites.net/appset.appinstaller" > MainBundle...Version="1.0.0.0" Uri="http://mywebservice.azurewebsites.net/appset.appinstaller" > MainBundle...Version="1.0.0.0" Uri="http://mywebservice.azurewebsites.net/appset.appinstaller" > MainBundle
NSString *pathString = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"h5...NSString *pathString = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"h5...NSString *pathString = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"h5
如果部署版本MainBundle中,图片不会被压缩。...2.如果图片不被放到images.xcassets中,即直接拖拽到项目当中,无论部署版本是多少,都会被放到MainBundle中。这样图片没有被压缩。
上代码和打印日志: /** 获取app的icon图标名称 */ - (void)getAppIconName{ NSDictionary *infoDict = [[NSBundle mainBundle...打印app里面所有启动图片名称信息 */ - (void)printAllLaunchImageInfo{ NSDictionary *infoDict = [[NSBundle mainBundle...UILaunchImageSize = "{320, 568}"; } ) */ } 看到了,项目AppIcon图标和启动图片信息,都可以从 [[NSBundle mainBundle...iPhone和iPad, 获取app的icon图标名称 */ - (void)getAppIconName{ NSDictionary *infoDict = [[NSBundle mainBundle...打印app里面所有启动图片名称信息 */ - (void)printAllLaunchImageInfo{ NSDictionary *infoDict = [[NSBundle mainBundle
webView.delegate = self; //2.加载请求 //加载的三种方式,加载三种数据 //《1》加载url请求 // NSURL url = [[NSBundle mainBundle...加载html(用于显示传递过来的内容,因为loadHTMLString传递的是什么,就显示什么)(这种方式加载的网页,不能回退) // NSString path = [[NSBundle mainBundle...string baseURL:nil]; //《3》加载data数据(可以加载图片,word,pdf等)(这个方法加载的也不能回退) //获取路径 NSString * path = [[NSBundle mainBundle
:NO]; //发送图片附件 //第一个图片名字是本地要选择发送的图片的名字, 第二个图片的名字是邮件里发送时显示的图片名字 NSString *pathImage = [[NSBundle mainBundle...dataImage mimeType:@”image/jpg” fileName:@”1.jpg”]; //发送txt文本附件 NSString *pathText = [[NSBundle mainBundle...dataText mimeType:@”text/txt” fileName:@”aa.txt”]; //发送doc文本附件 NSString *pathDoc = [[NSBundle mainBundle...dataDoc mimeType:@”text/doc” fileName:@”MyText.doc”]; //发送pdf文档附件 NSString *pathPdf = [[NSBundle mainBundle
NSTemporaryDirectory(); 5,获取应用程序程序包中资源文件路径的方法: 例如获取程序包中一个图片资源(apple.png)路径的方法: NSString *imagePath = [[NSBundle mainBundle...apple” ofType:@”png”]; UIImage *appleImage = [[UIImage alloc] initWithContentsOfFile:imagePath]; 代码中的mainBundle...] view plain copy // 获取当前程序包中一个图片资源(apple.png)路径 NSString *imagePath = [[NSBundle mainBundle
NSTemporaryDirectory(); 5,获取应用程序程序包中资源文件路径的方法: 比如获取程序包中一个图片资源(apple.png)路径的方法: NSString *imagePath = [[NSBundle mainBundle...apple” ofType:@”png”]; UIImage *appleImage = [[UIImage alloc] initWithContentsOfFile:imagePath]; 代码中的mainBundle...tmpDir = NSTemporaryDirectory(); // 获取当前程序包中一个图片资源(apple.png)路径 NSString *imagePath = [[NSBundle mainBundle
tnnproto 模型解析的步骤包括: 获取模型文件的路径 解析文件内容 初始化模型 // 获取模型文件 (提前把对应的模型文件集成到工程中) auto model_path = [[NSBundle mainBundle...ofType:nil]; auto proto_path = [[NSBundle mainBundle...(如果发现数据正常时,流程没有办法跑通的话,可以多换几个device_type看看) auto library_path = [[NSBundle mainBundle] pathForResource...:@"tnn.metallib" ofType:nil]; //shape数据 auto shape_path = [[NSBundle mainBundle] pathForResource:...; } 2.3 输入设定 输入设定主要是通过TNN的方法 SetInputMat 来完成的; //从文件获取模型的输入 auto mock_input_path = [[NSBundle mainBundle
// 查看所有的自定义相册 // 先查看是否有自己要创建的自定义相册 // 如果没有自己要创建的自定义相册那么我们就进行创建 NSString * title = [NSBundle mainBundle... [[PHPhotoLibrary sharedPhotoLibrary] performChangesAndWait:^{ NSString * title = [NSBundle mainBundle
---- 第一步, 拖入工程目录如下: 第二步, 获取文件路径: 这一步需要注意了,获取文件路径的时候不要偷懒使用这种方式 NSString *filePath = [[NSBundle mainBundle...] pathForResource:@"myp12.pfx" ofType:nil]; 要使用 NSString *filePath = [[NSBundle mainBundle] pathForResource