看起来:
[[NSBundle mainBundle] pathForResource:@"name" ofType:@"png"];
不为Images.xcassets资产目录中的资产返回任何内容.我也尝试过:
[[NSBundle mainBundle] pathForResource:@"name" ofType:@"png" inDirectory:@"Images"];
[[NSBundle mainBundle] pathForResource:@"name" ofType:@"png" inDirectory:@"Images.xcassets"];
但这些都没有.
有没有人成功检索目录中的资产路径?
我想继承一个具有工厂方法的框架类.如何使工厂方法返回我继承的类类型的对象?我发现这篇有用的文章描述了类似的情况,但在他们的情况下你可以控制超类.我怎么能写一个子类,UIImage它imageNamed:会返回我的子类类型的对象?