- (BOOL)canBecomeFirstResponder
{
return YES;
}
设置了上面的代码还是不显示,是因为项目的其它地方设置了某个window makeKeyAndVisible,所以在-(BOOL)canBecomeFirstResponder中要额外做一些事情才能显示menu:
- (BOOL)canBecomeFirstResponder
{
UIWindow *window = [[UIApplication sharedApplication].delegate window];
if ([window isKeyWindow] == NO)
{
[window becomeKeyWindow];
[window makeKeyAndVisible];
}
return YES;
}
希望后人珍惜时间,少走弯路,享受生活。
VKOOY
网友评论