我可能在这里遗漏了一些明显的东西,但我一直无法解决以下问题:
我有一个包含普通和视网膜屏幕图像资源的项目,例如someimage.png和someimage@2x.png,它们存储在一个单独的包中.当我构建项目时,Xcode自动将它们打包成一个多页tiff(imageName.tiff
),我在finder中检查了它 - 它实际上是两个图像的多重tiff.但是,出现了一个问题:我很难加载适当的资源.
我所做的是:
NSString * imageName = ... ;
NSLog(@"imageName: %@", imageName);
UIImage * someImage = [UIImage imageNamed: imageName];
Run Code Online (Sandbox Code Playgroud)
另外我给了辅助方法,它返回带有资源的bundle:
+(NSBundle *) resourcesBundle
{
NSBundle *bundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"MyResourcesBundle" withExtension:@"bundle"]];
return bundle;
}
Run Code Online (Sandbox Code Playgroud)
我试过以下imageName
:
imageName = [[AuxClass resourcesBundle] pathForResource:@"someimage" ofType:@"png"];
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我都null
对imageName
.
imageName = [[AuxClass resourcesBundle] pathForResource:@"someimage" ofType:@"tiff"];
Run Code Online (Sandbox Code Playgroud)
在这种情况下,会返回精确图像路径,但是只有在我使用imageWithContentsOfFile
而不是它时它才有效imageNamed
,并且它没有采用适当的资源:尽管有屏幕类型,它仍会为视网膜加载资源.
如果我省略filetype(就像我在添加@2x
资源之前所做的那样,并且它工作正常,并且我尝试了第一件事并且确定它会起作用)
imageName = [NSString stringWithFormat: @"%@/%@",
@"MyResourcesBundle.bundle"",
@"someimage" ];
Run Code Online (Sandbox Code Playgroud)
什么都没有加载. …
我试图在轴上旋转一个波,但不知怎的,如果我将传递到sin并且cos值大于45,波似乎会失真或者函数没有以适当的角度旋转.
...
wave
// ROtate
for (int i=0; i<300; i++){
coordinatesX[i] = ((coordinatesX[i] * (float)Math.cos(60)) - (coordinatesY[i] * (float)Math.sin(60))) + coordinatesX[i];
coordinatesY[i] = (coordinatesX[i] * (float)Math.sin(60)) + (coordinatesY[i] * (float)Math.cos(60)) + coordinatesY[i];
}
Run Code Online (Sandbox Code Playgroud)
这是整个代码:
// define newpath
float[] coordinatesX = new float[300];
float[] coordinatesY = new float[300];
// wave
for (int i=0; i<300; i++){
coordinatesX[i] = i;
coordinatesY[i] = (float)(20 * (Math.sin((-0.10 * coordinatesX[i]))));
System.out.println(coordinatesX[i]);
System.out.println(coordinatesY[i]);
}
// ROtate
for (int i=0; i<300; i++){
coordinatesX[i] = ((coordinatesX[i] * (float)Math.cos(-10)) - …
Run Code Online (Sandbox Code Playgroud) 有一个应用程序(已发布到Play商店)具有包名称,该应用程序不完全符合Java命名约定(如CompanyName.ApplicationName
).
今天,我无法将更新版本发布到Play商店,因为开发者控制台抱怨上传的APK的包名错误.现有的包名只包含字母,并且包含一个点,所以拒绝它的唯一原因是我能想到的是以大写字母开头的包名.它与先前使用的包名称匹配.
可以吗?是否有一些最近实施的包名称限制?
编辑
我得到的错误是
您的apk(CompanyName.ApplicationName)的包名称无效.包名称必须以字符开头,并且只能包含字符,数字,下划线和点.它们必须至少有一个点,不能以点结尾,并且不能包含多个连续点的任何运行.
andengine ×1
android ×1
game-physics ×1
google-play ×1
ios ×1
java ×1
objective-c ×1
png ×1
tiff ×1
xcode ×1