'-respondsToSelector:' not found in protocol(s)

The respondsToSelector: method is declared in the NSObject protocol. You have to make sure that your custom protocols also conform to the NSObject protocol. Change the declarations of your custom protocols from:

1
@protocol MyCustomProtocol...@end

To:

1
@protocol MyCustomProtocol <NSObject>...@end

增加vmware虚拟机的性能

vmware跑mac确实卡呀。网上抄了一段,目前还在体验中,效果具体怎么样,还有待观察。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
MemTrimRate=0
sched.mem.pshare.enable = "FALSE"
prefvmx.useRecommendedLockedMemSize = "TRUE"
prefvmx.minVmMemPct = "100"
mainMem.useNamedFile = "FALSE"
MemAllowAutoScaleDown = "FALSE"
mks.enable3d = "FALSE"
mks.noBeep = "true"
logging = "FALSE"
hv.enableIfUnlocked = "TRUE"

X Server连接到hp-ux字体问题解决办法

在用x server连接到hp-ux的时候,open view启动失败:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Warning: Missing charsets in String to FontSet conversion
Warning: Cannot convert string "-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*" to type FontSet
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.

Warning: Cannot convert string "-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*" to type FontList
Warning: Cannot convert string "-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*:" to type FontList
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.

Warning: Cannot convert string "-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*" to type FontList
Warning: Cannot convert string "-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*:" to type FontList
Warning: Missing charsets in String to FontSet conversion
Warning: Cannot convert string "-dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*" to type FontSet
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
Warning:
Name: FONTLIST_DEFAULT_TAG_STRING
Class: XmRendition
Conversion failed. Cannot load font.

Warning: Cannot convert string "-dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*" to type FontList
Warning: Cannot convert string "-dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*:" to type FontList
ovw: Xt Warning: Missing charsets in String to FontSet conversion
ovw: Xt Warning: Cannot convert string "-*-helvetica-medium-r-*-140-*" to type FontSet
ovw: Xt Warning: Missing charsets in String to FontSet conversion
ovw: Xt Warning: Unable to load any usable fontset
ovw: Xt Warning: Missing charsets in String to FontSet conversion
ovw: Xt Warning: Cannot convert string "-*-helvetica-medium-r-*-120-*" to type FontSet
ovw: Xt Warning: Missing charsets in String to FontSet conversion
ovw: Xt Warning: Unable to load any usable fontset
ovw: Xt Warning: Missing charsets in String to FontSet conversion
ovw: Xt Warning: Cannot convert string "-*-helvetica-medium-r-*-100-*" to type FontSet
ovw: Xt Warning: Missing charsets in String to FontSet conversion
ovw: Xt Warning: Unable to load any usable fontset
ovw: Xt Warning: Missing charsets in String to FontSet conversion
ovw: Xt Warning: Cannot convert string "-*-helvetica-medium-r-*-80-*" to type FontSet
ovw: Xt Warning: Missing charsets in String to FontSet conversion
ovw: Xt Warning: Unable to load any usable fontset
/opt/OV/bin

解决办法:

cocos2d-iphone popSceneWithTransition

原文链接:http://www.cocos2d-iphone.org/forum/topic/1076 在CCDirector.h添加

1
- (void) popSceneWithTransition: (Class)c duration:(ccTime)t;

在CCDirector.m中添加

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
-(void) popSceneWithTransition: (Class)transitionClass duration:(ccTime)t;
{
	NSAssert( runningScene_ != nil, @"A running Scene is needed");

	[scenesStack_ removeLastObject];
	NSUInteger c = [scenesStack_ count];
	if( c == 0 ) {
		[self end];
	} else {
		CCScene* scene = [transitionClass transitionWithDuration:t scene:[scenesStack_ objectAtIndex:c-1]];
		[scenesStack_ replaceObjectAtIndex:c-1 withObject:scene];
		nextScene_ = scene;
	}
}

调用方式

1
[[CCDirector sharedDirector] popSceneWithTransition:[CCSlideInRTransition class] duration:0.5f];

iOS退出程序

如果想在程序里面添加一个按钮“退出”,可以调用

1
[[UIApplication sharedApplication] terminateWithSuccess];

在cocos2d-iphone中添加退出按钮后的响应函数:

1
2
[[CCDirector sharedDirector] end];
[[UIApplication sharedApplication] terminateWithSuccess];