Giter VIP home page Giter VIP logo

Comments (5)

LuKane avatar LuKane commented on May 27, 2024

用 2.5.5 Pod试试!! 方便的话, 把 2.5.5的bundle的图片资源 是否找到 和我说一下! 谢谢

from knphotobrowser.

sjsurf avatar sjsurf commented on May 27, 2024

可以获取到了,但是可能用Bundle来获取资源,会更简单一些

`- (UIImage*)loadImage:(NSString*)imageName {
NSString *bundlePath = [[NSBundle bundleForClass:self.class].resourcePath stringByAppendingPathComponent:@"KNPhotoBrowser.bundle"];
NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];

UIImage *image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil];
return image;

}`

from knphotobrowser.

LuKane avatar LuKane commented on May 27, 2024

我这边也是用的 bundle
NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(@"KNPhotoBrowser")];

你上面写的代码有点浪费资源:

NSString *bundlePath = [[NSBundle bundleForClass:self.class].resourcePath stringByAppendingPathComponent:@"KNPhotoBrowser.bundle"];
NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];

把 bundle 转成 path, 再把path转成 bundle

from knphotobrowser.

sjsurf avatar sjsurf commented on May 27, 2024

哈,就是之前拿了之前的demo的代码,我看你2.5.5读资源是根据scale区分了图片的名称。
UIImage *image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil]; return image;我之前看文档是会根据设备型号自动区分的。

from knphotobrowser.

LuKane avatar LuKane commented on May 27, 2024

那个好像类似于 Assets.xcassets 功能!! 我这边只做了个简单的实现!

from knphotobrowser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.