首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏iOS逆向与安全

    iOS加载本地HTML、pdf、doc、excel文件 & HTML字符串与富文本互转

    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

    2.4K30发布于 2021-07-05
  • 来自专栏陈满iOS

    iOS开发:从本地文件读取字符串:stringWithContentsOfFile&initWithContentsOfFile

    加载本地.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

    3.4K20发布于 2018-09-10
  • 来自专栏iOS122-移动混合开发研究院

    实现iOS图片等资源文件的热更新化(二):自定义的动态 imageNamed

    ].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

    1.4K60发布于 2018-01-02
  • 来自专栏青玉伏案

    iOS开发之抽屉效果实现

    获取主视图的导航控制器 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

    2.3K60发布于 2018-01-11
  • 来自专栏APP自动化测试

    iOS-使用ALAssetsLibrary获取相册图片视频

    localizedDescription]); }]; 使用AVAsset加载资源: NSURL *assetURL = [[NSBundle mainBundle default: break; } }]; 获得元数据 NSURL *assetURL = [[NSBundle mainBundle albumItem = albumMetadata[0]; } }]; 使用AVMetadataItem NSURL *assetURL = [[NSBundle mainBundle

    1.4K50发布于 2019-10-15
  • 来自专栏nimomeng的自我进阶

    NSBundle官方文档

    mainBundle = [NSBundle mainBundle]; 或者通过Core Foundation来获取,如果你在写一个基于C的APP的话: mainBundle = CFBundleGetMainBundle (); 通过Path获取Bundles 如果你想访问一个非mainBundle的bundle,那么你可以创建一个合适的bundle对象,如果你知道这个bundel的路径的话。

    2.6K20发布于 2018-09-13
  • 来自专栏Python疯子

    UIWebview与OC交互以及加载失败

    (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

    1.4K10发布于 2018-09-06
  • 来自专栏ShaoYL

    自定义View

    新建一个继承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:<#(NSString *)#>

    93360发布于 2018-05-11
  • 来自专栏APP自动化测试

    获取设备信息

    mark下如何获取设备相关的信息 NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; // app名称 NSString localizedModel]; NSLog(@"国际化区域名称: %@",localPhoneModel ); NSDictionary *infoDictionary = [[NSBundle mainBundle

    2.5K11发布于 2019-10-15
  • 来自专栏林德熙的博客

    win10 uwp 安装文件 appinstaller 格式

    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

    10.5K60发布于 2019-03-13
  • 来自专栏韦弦的偶尔分享

    WKWebView 加载 Uni-App 导出的本地 H5

    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

    1.5K30编辑于 2022-09-21
  • 来自专栏DannyHoo的专栏

    Xcode中将图片放到images.xcassets中的好处

    如果部署版本<ios8 ,打包的资源包中的图片会被放在MainBundle中,图片不会被压缩。 2.如果图片不被放到images.xcassets中,即直接拖拽到项目当中,无论部署版本是多少,都会被放到MainBundle中。这样图片没有被压缩。

    1.4K20发布于 2018-09-13
  • 来自专栏大师级码师

    UIWebView的使用

    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

    67800发布于 2021-10-31
  • 来自专栏谈补锅

    iOS获取app图标和启动图片名字(AppIcon and LaunchImage's name)

    上代码和打印日志: /** 获取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

    4.9K20发布于 2019-02-25
  • 来自专栏全栈程序员必看

    ios的邮箱怎么用_ios邮箱怎么添加多个账号

    :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

    1.9K20编辑于 2022-11-08
  • 来自专栏css小迷妹

    IOS中获取各种文件的目录路径的方法

    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

7.7K20发布于 2021-10-29
  • 来自专栏stringwu的互联网杂谈

    TNN iOS非图像模型入门

    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

    85820编辑于 2022-08-12
  • 来自专栏全栈程序员必看

    IOS获得各种文档文件夹路径的方法

    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

    2.2K30编辑于 2022-07-06
  • 来自专栏落影的专栏

    iOS本地数据存储

    NSBundle * mainBundle = [NSBundle mainBundle]; 这样我们就拿到我们的mainBundle,通过mainBundle我们可以查找对应的资源: NSString *path =[mainBundle pathForImageResource:@"some_pic_name"]; // 查找图片地址 也可以通过mainBundle直接加载xib: [[NSBundle mainBundle] loadNibNamed:@"SSProgressView" owner:self options:nil]; 思考题? NSString *path = [[NSBundle mainBundle] pathForResource:@"SSTestPod" ofType:@"bundle"]; NSBundle *podBundle , nonatomic, copy) NSString *name; @end CoreData的具体使用: //从本地加载对象模型 NSString *modelPath = [[NSBundle mainBundle

    3.7K20发布于 2019-07-15
  • 来自专栏LinXunFeng的专栏

    iOS 组件化开发(三):加载资源文件

    imageNamed // load from main bundle 可以看到,官方注释着imageNamed加载的是main bundle中的资源,mainBundle的位置如下图 ? mainBundle 这样当然就无法加载到图片啦,我们需要让它加载自己当前所在bundle里的图片 ,所以加载图片的代码需要进行修改 NSString *normalImgName = @"个人@2x.png 中值得一提的是,如果是直接在xib中拖入一个imageView控件来设置图片的加载,我们则需要在图片名字前加上当前bundle名称 LXFMain.bundle/个人 这里除了当前xib要加载的图片不属于mainBundle

    2.2K41发布于 2018-06-29
  • 领券