1.IQKeyboardManager多输入框自动切换问题
使用IQKeyboardManager的时候,当有多个输入框的时候,想要IQKeyboardManager能自动帮你切换到下一个输入框,需要如下设置:
[[IQKeyboardManager sharedManager] considerToolbarPreviousNextInViewClass:[tableView class]];
假如你的输入框是加在
self.view,此处的
tableView需改成
self.view。
2. IQKeyboardManager键盘弹出时,我的标题栏被强大的冲击力顶上天了,看图:
我有点恶心的标题栏被无情的顶上去了,好吧,肯定是我用的方法有问题,在一篇文章上找到我需要的答案,
原文地址
,简要概括就是:如果你不使用storyboard或xib创造你的视图。你需要重写
-(void)UIViewController loadview
方法,需要设置一个UIScrollView实例self.view,已让IQKeyboardManager可以管理UINavigationBar。而我是用纯代码写的布局,所以出现了上面的问题,重写代码如下:
-(void)loadView
{
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.view = scrollView;
}
效果如图:
3.tabBarController切换到我的,未登录时弹出登录界面,若点击取消,回到原本的界面,如图:
主要是在tabBar的delegate里面做一些操作,代码如下:
-(BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
NSLog(@"select = %lu,vie = %@",(unsigned long)tabBarController.selectedIndex,viewController);
_oldSelectIndex = tabBarController.selectedIndex;//记录变化前的index
return YES;
}
-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
if (tabBarController.selectedIndex == 3) {
if (!isLogin) {
tabBarController.selectedIndex = _oldSelectIndex;//未登录切换为原来的页面,如此处不先切换为原来的页面,会看到我的界面一闪而过
[LoginHelper loginWithFinishBlock:^(BOOL result) {
if (result) {
tabBarController.selectedIndex = 3;//登录成功再执行切换界面操作
}
} parentVc:self];
}else{
UITabBarItem * tabBarItem = [tabBarController.tabBar.items objectAtIndex:tabBarController.selectedIndex];
[tabBarItem setTitleTextAttributes:@{ UITextAttributeTextColor : color_929292 }
forState:UIControlStateNormal];
[tabBarItem setTitleTextAttributes:@{ UITextAttributeTextColor : color_from_rgb(0xf96650) }
forState:UIControlStateSelected];
}
}else{
UITabBarItem * tabBarItem = [tabBarController.tabBar.items objectAtIndex:tabBarController.selectedIndex];
[tabBarItem setTitleTextAttributes:@{ UITextAttributeTextColor : color_929292 }
forState:UIControlStateNormal];
[tabBarItem setTitleTextAttributes:@{ UITextAttributeTextColor : color_from_rgb(0xf96650) }
forState:UIControlStateSelected];
}
}
在
tabBar
切换前
shouldSelectViewController
获取到旧的界面的
index
,在切换的
delegate
,
didSelectViewController
中加入判断,若已经登录,不做操作,若未登录,将当前的
tabBarController
的
selectedIndex
设置为
_oldSelectIndex
,登录成功之后再把
tabBarController
的
selectedIndex
设置为所需显示的界面,失败不做操作.
4. 渐现的nav
看图:

原文地址,传送门。
有一个比较重要的,在xcode的顶部菜单栏找到Debug > View Debugging > Capture View Hierarchy:

一般照着原文的demo,效果出不来,就需要用这个去找原因了,我自己原本也出不来,用这个看了下,是前面
还有个view把我的nav挡住了,用了runtime将那个view的背景设置为透明,效果便出现了.
6. 微信支付无法调起的问题
之前的一篇文章曾提起过,点此查看,主要是集成的ShareSDK的微信SDK不支持微信支付,和客服确认过,
客服回答是我们不是做支付的,所以是不支持微信支付,自己去微信官网下载个SDK,替换即可。
7. iOS9 微博登录崩溃问题,替换新版SDK可解决。
8. iOS提审问题:
(1)引导页加滑动隐藏
引导页不管是上下滑动或者左右滑动,最好加多一个在最后一页继续滑动就进入app,我第一次提审的时候,因为没有加上,直接返回,理由是无法进入app,可是我最后一页放了个立即开始的按钮,估计是外国佬审核看不懂中文。
(2)没安装微信隐藏相关功能
手机没安装微信,需要将与微信相关的功能都隐藏,假若只是弹出提示,请安装微信或者跳转到微信安装的AppStore页面,也是会被拒,我隐藏了之后,审核通过。
9. 开启了侧滑返回,要拦截事件
需要先设置
self.navigationController.interactivePopGestureRecognizer.delegate = self;
然后重写- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer拦截侧滑事件:
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{
[_alertView show];
return NO;
}
返回no表示将事件终结,相当于后面的操作无法响应,成功拦截下.
暂时记录如上。