在我的应用程序中,我需要在点击状态栏时触发显示一些自定义视图。我想出了通过继承 UIApplication 来获取事件的方法。
如果我使用下面的代码,Apple 会阻止我的应用程序使用私有 API 吗?
- (void)sendEvent:(UIEvent *)event{
[[event allTouches] enumerateObjectsUsingBlock:^(UITouch * touch,BOOL * stop){
if (touch.tapCount==1 && touch.phase==UITouchPhaseEnded) {
NSString * touchedViewClassName = NSStringFromClass([touch.view class]);
if ([touchedViewClassName isEqualToString:@"UIStatusBarForegroundView"]) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"StatusBarTapped" object:nil];
}
}
}];
[super sendEvent:event];
}
请指教...