一、点击tabbar刷新数据
在UITabBarController中实现,遵循<UITabBarControllerDelegate>,实现代理方法
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
//_index记录点击的selectedIndex,开始的时候设置初始值为-1
if (_index == tabBarController.selectedIndex) {
//发送刷新的通知,userInfo传点击的selectedIndex,以便区分刷新的tabbar
[kNSNotificationCenter postNotificationName:kSelectTabBarRefresh object:nil userInfo:@{kTabBarSelectedIndex : @(_index)}];
}
_index = tabBarController.selectedIndex;
//1秒后重置初始值
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
_index = -1;
});
}
二、present 一个UIImagePickerController,导航栏遮挡(导航栏半透明状态)的解决方案
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
viewController.navigationController.navigationBar.translucent = NO;
}
三、使用Apple提供的私有接口调式UI(二只手指同时点击状态栏)
SEL selector = NSSelectorFromString(@"prepareDebuggingOverlay");
[NSClassFromString(@"UIDebuggingInformationOverlay") performSelector:selector withObject:nil afterDelay:0];
网友评论