[文章]使用Flipboard的FLEX进行iOS程序调试

FLEX不需要复杂的配置,调试模式的操作也很方便简单,项目的地址是:https://github.com/Flipboard/FLEX

先在项目的Podfile里添加

 
  1. pod 'FLEX'

然后import

 
  1. #if DEBUG
  2. #import "FLEXManager.h"
  3. #endif

最后在希望开启的地方加上

 
  1. #if DEBUG
  2. [[FLEXManager sharedManager] showExplorer];//开启flex的调试模式
  3. #endif

我现在用的最多的就是使用global查看沙盒文件,用select和move调整位置布局。当然我觉得把这个调试工具加到其他人的项目来跟踪学习调试是最合适的了。

[文章]手写UITabBarController的方法

最近把已阅的抽屉取消了换成了操作更加便捷的TabBar。下面是实现的方法。一下代码写在didFinishLaunchingWithOptions里。

//首页
[[UINavigationBar appearance] setTintColor:[UIColor rss_cyanColor]];
SMViewController *smViewController = [[SMViewController oc]initWithNibName:nil bundle:nil];
UINavigationController *rootViewNav = [[UINavigationController oc]initWithRootViewController:smViewController];
rootViewNav.tabBarItem.title = @"首页";
rootViewNav.tabBarItem.image = [UIImage geNamed:@"icoHomeFilled"];
//收藏
SMRSSListViewController *favVC = [[SMRSSListViewController oc]initWithNibName:nil bundle:nil];
favVC.isFav = YES;
favVC.isNewVC = YES;
UINavigationController *navFavVC = [[UINavigationController oc]initWithRootViewController:favVC];
navFavVC.tabBarItem.title = @"收藏";
navFavVC.tabBarItem.image = [UIImage ageNamed:@"icoFavFilled"];
//设置
SMSettingViewController *smSettingVC = [[SMSettingViewController oc]initWithNibName:nil bundle:nil];
UINavigationController *navSettingVC = [[UINavigationController oc]initWithRootViewController:smSettingVC];
navSettingVC.tabBarItem.image = [UIImage geNamed:@"icoSettingFilled"];
//
UITabBarController *tabBarC = [[UITabBarController oc]initWithNibName:nil bundle:nil];
tabBarC.viewControllers = @[rootViewNav,navFavVC,navSettingVC];
self.window.rootViewController = tabBarC;

还有个地方要注意的是如果希望在TabBar嵌套Nav时,进行Push的时候隐藏TabBar可以这么做

SMRSSListViewController * rssListVC = [[SMRSSListViewController alloc] init];
rssListVC.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:rssListVC animated:YES];

如果要改变点击后icon和文字的颜色可以这样

[[UITabBar appearance]setTintColor:[UIColor rss_cyanColor]];

[文章]iOS启动屏后再加个闪屏的方法

在- (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions 里添加

self.window.rootViewController.view.alpha = 0;
UIImageView *splashImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"splash"]];
[self.window addSubview:splashImageView];
[UIView animateWithDuration:0.7 animations:^{
    self.window.rootViewController.view.alpha = 1.0;
} completion:^(BOOL finished) {
    [addSubview:splashImageView removeFromSuperview];
}];