我做的第一件事是设置选定的单元格.
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
cell.selected = YES;
return cell;
}
Run Code Online (Sandbox Code Playgroud)
并且成功选择了单元格.如果用户触摸所选单元格,则应取消选择单元格并调用委托.但这绝不会发生.
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"%s", __PRETTY_FUNCTION__);
}
- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"%s", __PRETTY_FUNCTION__);
}
Run Code Online (Sandbox Code Playgroud)
我知道如果我以编程方式设置选择,则不会调用委托.委托和数据源已设置.
但是,此委托被调用:
- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"%s", __PRETTY_FUNCTION__);
return YES;
}
Run Code Online (Sandbox Code Playgroud)
如果我删除了cell.selected = YES一切正在工作.有没有人可以解释这种行为?
我用swift开始了一个vanilla master详细项目.如果我添加新的视图控制器并设置自定义类,则模块列表为空,并且无法选择模块.错误消息"Interface Builder文件中的未知类".如果我运行代码,则会出现在控制台中.如何设置故事板以了解自定义类和模块?
它应该如何.模板中的两个类都很好.

它是怎么回事

我必须添加customModule="Target_Name" customModuleProvider="target"到界面构建器源代码中.那太烦人了!
更新:如果我将整个项目目录移动到另一个目录,例如移动到桌面,它可以工作.看起来我的名为"Repository"的目录已损坏.不知道为什么:(
你知道我的齿轮是什么吗?
我从ftp服务器分发一些beta应用程序.应用程序使用通配符配置文件进行签名.安装这些应用程序时,会出现一个带有进度的图标.应用程序准备就绪后,此安装图标应该会消失.但在iOS 7上,这些图标仍然存在.它以app图标和bug安装图标结束.我可以删除该应用,但不能删除安装图标.
"X"按钮也丢失了.
如何摆脱这个图标?

我想在Xcode 6.0.1中使用一个游乐场.所以文件 - >新 - >游乐场
我立刻得到了错误.游乐场执行终止,因为游乐场进程意外退出.见图.重启Xcode没有帮助.
Xcode有什么问题?
本课题引用了这个问题: 如何用块简化回调逻辑?
我的标题有这些typedef
typedef void (^StuffDoneBlock)(NSDictionary * parsedData);
typedef void (^StuffFailedBlock)(NSError * error);
Run Code Online (Sandbox Code Playgroud)
并在初始化
stuffDoneCallback = Block_copy(done);
StuffFailedCallback = Block_copy(error);
Run Code Online (Sandbox Code Playgroud)
在本文中,它说Block_copy是不必要的.但是它需要一个桥接演员.编译器消息如下:
error: cast of block pointer type 'StuffDoneBlock' (aka 'void (^)(NSDictionary *__strong)') to C pointer type 'const void *' requires a bridged cast [4]
stuffDoneCallback = _bridge(Block_copy(done));
^~~~~~~~~~~~~~~~
/Developer-4.2/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/usr/include/Block.h:60:61: note: instantiated from:
#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud) 我有一些radiobuttons但是toucharea是小的.toucharea取决于图像大小.有没有一种优雅的方法来扩展触摸区域与cocos2d而不使用更大的图像或使用cgrect我自己的触摸区域?setContentSize做我想要的.不幸的是,图像移动到内容大小的左下角.设置anchorpoint会移动内容,但图像会保留在左下角.
CCMenuItem* pickEasy = [CCMenuItemImage itemFromNormalImage:@"radiobutton_off.png" selectedImage:@"radiobutton_on.png" target:self selector:@selector(pickEasyTapped:)];
pickEasy.position = ccp(ss.width * 0.40, ss.height * 0.78);
[pickEasy setContentSize:CGSizeMake(50, 50)];
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我制作了一个包含一些小动画的棋盘游戏.我将fps从60降低到30以减少处理器负载.但该设备仍然非常温暖.没有cocos2d的另一个应用程序不是那么加热它.有没有办法让iPhone平静下来?设备状态如下:
如果我在SKScene子类init方法中运行此代码
for (int i = 0; i < 100; i++) {
SKShapeNode *shape = [SKShapeNode node];
shape.antialiased = NO;
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddEllipseInRect(path, NULL, CGRectMake(arc4random()%320, arc4random()%320, 10, 10));
shape.path = path;
[shape setStrokeColor:[UIColor blackColor]];
CGPathRelease(path);
[self addChild:shape];
[shape removeFromParent];
}
Run Code Online (Sandbox Code Playgroud)
每次我在SKView控制器中运行此代码
SKView * skView = (SKView *)self.view;
// Create and configure the scene.
SKScene * scene = [ZTMyScene sceneWithSize:skView.bounds.size];
scene.scaleMode = SKSceneScaleModeAspectFill;
// Present the scene.
[skView presentScene:scene];
Run Code Online (Sandbox Code Playgroud)
我的内存使用量一直在增长,直到内存已满并崩溃.如果我使用SKSpriteNode,则不会发生这种情况.有没有人解决这个问题?
简介:我创建了sprite kit模板项目,添加了很多SKShapeNodes并用新的SKScene替换旧的SKScene.
我向github https://github.com/zeiteisen/MemoryTest添加了一个示例项目
我在我的本地机器上安装了jenkins.比我创建了一个示例应用程序,其中包含一个失败和一个后续单元测试.当我在终端中发出以下命令时
xcodebuild -scheme'SampleWithTest'-sdk iphonesimulator7.0 -destination platform ='iOS Simulator',OS = 7.0,name ='iPhone Retina(3.5英寸)'清洁测试
比清洁构建项目,启动模拟器并进行测试.这是应该如何工作的.
当我通过jenkins运行相同的命令时,它会清理构建项目并以**TEST SUCCEEDED**结束,而无需启动模拟器或打印出测试结果.Jenkins刚刚假装,测试成功了.
我在我的本地机器上测试它.没有什么无头,远程,源代码控制,奴隶,代码签名或任何可能造成任何麻烦的事情.
Xcode 5拒绝索引任何项目.它等待xcodebuild.我已经删除了派生数据,删除了project.xcworkspace文件,清理并重新启动.已安装命令行工具.它是OSX 10.8.5上的Xcode 5.0.2.

ios ×5
xcode ×3
ios7 ×2
objective-c ×2
swift ×2
area ×1
button ×1
dashboard ×1
extend ×1
heat ×1
icons ×1
ios8 ×1
iphone ×1
jenkins ×1
module ×1
sprite-kit ×1
touch ×1
unit-testing ×1
xcode5 ×1
xcodebuild ×1