自升级到xcode 4以来,我无法找到指定资源所属目标的位置.以前,我选择了文件并点击命令+ i,但现在这似乎运行程序,而不是打开该文件的信息框.
我想使用精彩的Appirater代码来鼓励用户评价我的应用程序,我尚未提交.为此,您需要拥有Apple提供的软件ID.由于我尚未提交我的应用程序,因此我没有此ID号码.我当然有我的Bundle Seed ID和Bundle Identifier,但我的理解是这些不一样.是否有可能在提交前获得软件ID?或者我必须在发布后立即更新应用程序吗?
谢谢,
迈克尔.
我想禁用我的UIButton,所以我打电话给:
button.enabled = FALSE;
Run Code Online (Sandbox Code Playgroud)
然而,这使按钮透视,我可以看到它下面的元素.我不介意它改变颜色,我只是不希望它是透明的.
我已经尝试在IB中勾选"不透明"和"剪辑子视图"的方框,但没有快乐.
有没有一种简单的方法来解决这个问题?我想我可以在UIImageView后面放一个相同的按钮图像,但这不是一个优雅的解决方案.
谢谢大家!!
迈克尔
我遇到了iOS9的巨大性能问题,我无法弄清楚该怎么做.我已经阅读了很多帖子 - 这里,例如,这里,但他们建议的解决方案没有帮助或没什么区别.
我的游戏已经从原来的iPad 2(iOS 8.4)上的60fps变为新iPad mini(iOS 9)上的<15fps.
我正试图解决主要罪魁祸首.我很确定其中一个是SKCropNodes.我通常在场景中渲染几个SKCropNodes(6-18).这在iOS8中从来都不是问题,但它看起来像是iOS9,虽然它可以更好地裁剪,但也会降低性能.
如果我将裁剪节点渲染为正常的SKSpriteNodes,我可以在旧设备上获得5fps,在较新的iPhone 6上获得高达30fps.我无法使用裁剪节点,但这不是完整的问题.
我想也许正在使用错误的纹理图集 - 即一个更大的分辨率.但是迫使我的设备使用非常小的地图集没有区别.
我正在使用Texture Packer生成我的地图集,其中包含不同设备的缩放变体.我注意到XCAssets现在有一个添加Sprite Atlas的选项(我似乎无法找到任何关于此的文档).这不适合我的游戏,因为我使用了100多个精灵.我已经尝试将我的地图集添加到XCAssets,但由于某种原因它不会使用缩放变体.然而,由于纹理低,它仍然可以运行得非常糟糕.
我试过设置
skView.ignoresSiblingOrder = YES;
Run Code Online (Sandbox Code Playgroud)
并给出了我所有节点的zPosition值,但仍然没有效果.我还为每个图像名称添加了.png扩展名(原来这个问题意味着它们不会呈现.)
我的场景中有一些SKEffectNodes,但删除和添加这些似乎没有效果.
我不明白相同的硬件和相同的代码如何产生如此截然不同的结果.显然,苹果已经改变了与渲染产生负面影响的事情.他们似乎也无意解决这些问题.我知道这个问题的漏洞已存在数月 - 早在iOS9发布之前.
我已经在这个游戏上工作了2年,而且只是在iOS9之前发布了它.它现在遭受了糟糕的表现和经常性的崩溃.
有没有人弄清楚苹果究竟做了什么来扼杀表现?如果我知道,我至少可以尝试解决它...谢谢.
UPDATE
下面是同一场景的一些数字,以及游戏一次产生的绝对最大节点数.
iOS 8,iPad 2,〜200个节点,~100个绘图,58.7 - 60 fps
iOS 9,iPhone6,~280个节点,~216个绘图,大约20 fps
我假设节点数量的差异是由于不同的屏幕尺寸.如果我改变iPhone 6上的场景以达到相同的值,FPS仍然在24左右.
更新2
使用Xcode的模板Sprite Kit项目,并将太空船改为包含宇宙飞船的SKCropNode,在iOS 8上,我可以添加100个没有帧速率问题的船只.在iOS 9上,相同的项目,我可以在帧速率降至<30之前添加大约25个.
iPad2上的iOS 8:
iOS 9 iPhone 5:
就纹理图集的使用而言,如我的评论中所述,我无法保证从同一地图集中提取任何内容.我的游戏包含自定义角色,其中包含来自各种地图集的资源(每个地图包含约100个纹理).屏幕上一次最多可以有9个字符.我知道这不是最有效的抽奖方式,但我直到iOS9才出现问题...
更新3
我向Apple提交了一个错误,包括我的示例程序.我还用完了我的一项技术支持请求.到目前为止,Apple没有任何内容.
我是Quartz的新手.我有2个图像,一个背景和一个带有剪裁形状的面具,我想要在背景上放置以剪切一个部分.生成的图像应该是切口的形状.这是我的面具(中间的形状是0 alpha):
这是我的代码:
UIView *canvas = [[[sender superview] subviews] objectAtIndex:0];
UIGraphicsBeginImageContext(canvas.bounds.size);
CGColorSpaceRef colourSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef cgContext = CGBitmapContextCreate(NULL, canvas.bounds.size.width, canvas.bounds.size.height, 8, 0, colourSpace, kCGImageAlphaPremultipliedLast);
CGColorSpaceRelease(colourSpace);
CGImageRef maskImage = [[UIImage imageNamed:@"Mask.png"] CGImage];
CGContextClipToMask(cgContext, CGRectMake(0, 0, canvas.frame.size.width, canvas.frame.size.height), maskImage);
CGImageRef maskedImageRef = CGBitmapContextCreateImage(cgContext);
CGContextRelease(cgContext);
UIImage *maskedImage = [UIImage imageWithCGImage:maskedImageRef];
UIGraphicsEndImageContext();
[button setBackgroundImage:maskedImage forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)
除了什么都没有出现......我知道哪里出错了?非常感谢.
我通过执行以下操作将一个新的ViewControllers堆栈设置到我的navigationController:
MainMenuViewController *mainMenuViewController = [[MainMenuViewController alloc] init];
NSArray *controllerArray = [NSArray arrayWithObject:mainMenuViewController];
[mainMenuViewController release];
[self.navController setViewControllers:controllerArray animated:YES];
Run Code Online (Sandbox Code Playgroud)
唯一的问题是我似乎无法设置过渡风格.理想情况下,我希望它能够翻转.这可能吗?重要的是我使用setViewControllers:animated而不是presentModalViewController,因为我在堆栈之间来回切换,并希望维护每个堆栈的导航控制行为.
xcode objective-c uiviewcontroller uinavigationcontroller ios
我正在制作一个钟摆,它从0度摆动到最大200度,然后再回来.问题是,如果钟摆超过180度,它将通过最短路径返回到0,顺时针方向继续.而且我希望它逆时针走.这是我的代码:('right'是一个布尔值,当钟摆从左向右摆动时为TRUE)
- (void)swingPendulum {
CABasicAnimation *rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
if (right)
rotationAnimation.toValue = [NSNumber numberWithFloat:degreesToRadians(kMax)];
else
rotationAnimation.toValue = [NSNumber numberWithFloat:degreesToRadians(kMin)];
rotationAnimation.duration = 1.0;
rotationAnimation.repeatCount = 1.0;
rotationAnimation.delegate = self;
rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
rotationAnimation.removedOnCompletion = NO;
[pendulum.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}
Run Code Online (Sandbox Code Playgroud)
我有什么想法可以使这项工作?这是我的摇摆仪拼图的最后一块,否则它很棒:D谢谢!
迈克尔
我有一个使用两个UINavigationControllers的应用程序 - 一个用于菜单系统,另一个用于实际游戏.在我的appDelegate中声明了一个常见的UINavigationController.当应用加载时,它会加载菜单或游戏的UINavigationController.当然,玩家可以在两者之间导航.
从菜单到游戏时,我创建了一个新的UINavigationController,并按如下方式呈现:
GameViewController *rootController = [[GameViewController alloc] init];
UINavigationController *newNavController = [[UINavigationController alloc] initWithRootViewController:rootController];
[rootController release];
newNavController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:newNavController animated:YES];
[newNavController release];
Run Code Online (Sandbox Code Playgroud)
但是,我注意到当我这样做时,Menu的viewController从不调用dealloc.大概是因为仍然有人提到让它保持活力的东西.我发现当我明确地将App Delegate的UINavigationController设置为新的导航控制器时(在释放新的navController之前),它会释放菜单.我这样做如下:
MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.navController = newNavController;
[newNavController release];
Run Code Online (Sandbox Code Playgroud)
这是好习惯吗?我发现当从游戏导航回菜单时,同样的技巧似乎不起作用.即
MainMenuViewController *menuViewController = [[MainMenuViewController alloc] init];
UINavigationController *newNavController = [[UINavigationController alloc] initWithRootViewController:menuViewController];
[menuViewController release];
newNavController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:newNavController animated:YES];
//Setting the appDelegate's navController to the new navController allows the menu to dealloc.
//This must happen AFTER the newNavController …
Run Code Online (Sandbox Code Playgroud) iphone delegates memory-management objective-c uinavigationcontroller
我正在构建一个我已经发布的应用程序版本,但有一些更改.它不是一个精简/完整版本关系,但它们足够相似,我正在使用具有不同目标的相同项目.
我想重新编写我在新版本的第一个版本中使用的几乎所有字符串,并且想知道解决此问题的最佳方法.我没有在声明每个字符串之前使用#ifdef/#else语句,而是考虑使用NSLocalizedStrings.但是,实际语言仍然相同.
我在这篇文章中读到你可以自己设置语言,所以大概我可以发明自己的语言并将其设置为那个.但我想知道这是不是最好的办法?任何建议都是最受欢迎的.
我有一个名为PhotoBoothController的类,我用它来使用手势操作图像.我在iPhone上运行时工作正常.但是当我在iPad上运行它时,我在UIPopoverController中显示PhotoBoothController.图像看起来很好,但我无法操纵它,因为我的手势似乎没有被识别.我不知道如何让UIPopoverController控制手势.
我提出了popovercontroller并配置了视图:
- (void)presentPhotoBoothForPhoto:(UIImage *)photo button:(UIButton *)button {
//Create a photoBooth and set its contents
PhotoBoothController *photoBoothController = [[PhotoBoothController alloc] init];
photoBoothController.photoImage.image = [button backgroundImageForState:UIControlStateNormal];
//set up all the elements programmatically.
photoBoothController.view.backgroundColor = [UIColor whiteColor];
//Add frame (static)
UIImage *frame = [[UIImage imageNamed:@"HumptyLine1Frame.png"] adjustForResolution];
UIImageView *frameView = [[UIImageView alloc] initWithImage:frame];
frameView.frame = CGRectMake(50, 50, frame.size.width, frame.size.height);
[photoBoothController.view addSubview:frameView];
//Configure image
UIImageView *photoView = [[UIImageView alloc] initWithImage:photo];
photoView.frame = CGRectMake(50, 50, photo.size.width, photo.size.height);
photoBoothController.photoImage = photoView;
//Add canvas
UIView *canvas = …
Run Code Online (Sandbox Code Playgroud) objective-c gesture-recognition uipopovercontroller uigesturerecognizer ios
objective-c ×10
iphone ×6
xcode ×3
ios ×2
app-id ×1
clipping ×1
delegates ×1
ios9 ×1
masking ×1
performance ×1
quartz-2d ×1
rotation ×1
sprite-kit ×1
submission ×1
target ×1
targets ×1
transparent ×1
uibutton ×1
xcode4 ×1
xcode7 ×1