信息勝于事實
APP架構設計有三種方式,我們以這個頁面中間圓形按鈕的頁面跳轉為例:
不管是什么設計坦辟,我們都會有一堆目標ViewController類:
1刊侯、最原始的設計:
ViewController.m
#import "ALiLuXingViewController.h"
#import "ChongZhiViewController.h"
#import "FengLeiViewController.h"
#import "JuHuaSuanViewController.h"
#import "KouBeiWaiMaiViewController.h"
#import "LingJinBiViewController.h"
#import "TaoShengHuoViewController.h"
#import "TianMaoViewController.h"
#import "TianMaoGuoZhiViewController.h"
#import "TianMaoChaoShiViewController.h"
-(void)showALiLuXingViewController
{
ALiLuXingViewController *aLiLuXingViewController = [[ALiLuXingViewController alloc]init];
[self.navigationController pushViewController:aLiLuXingViewController animated:YES];
}
-(void)showChongZhiViewController
{
ChongZhiViewController *chongZhiViewController = [[ChongZhiViewController alloc]init];
[self.navigationController pushViewController:chongZhiViewController animated:YES];
}
-(void)showFengLeiViewController
{
FengLeiViewController *fengLeiViewController = [[FengLeiViewController alloc]init];
[self.navigationController pushViewController:fengLeiViewController animated:YES];
}
-(void)showJuHuaSuanViewController
{
JuHuaSuanViewController *juHuaSuanViewController = [[JuHuaSuanViewController alloc]init];
[self.navigationController pushViewController:juHuaSuanViewController animated:YES];
}
-(void)showKouBeiWaiMaiViewController
{
KouBeiWaiMaiViewController *kouBeiWaiMaiViewController = [[KouBeiWaiMaiViewController alloc]init];
[self.navigationController pushViewController:kouBeiWaiMaiViewController animated:YES];
}
-(void)showLingJinBiViewController
{
LingJinBiViewController *lingJinBiViewController = [[LingJinBiViewController alloc]init];
[self.navigationController pushViewController:lingJinBiViewController animated:YES];
}
-(void)showTaoShengHuoViewController
{
TaoShengHuoViewController *taoShengHuoViewController = [[TaoShengHuoViewController alloc]init];
[self.navigationController pushViewController:taoShengHuoViewController animated:YES];
}
-(void)showTianMaoViewController
{
TianMaoViewController *tianMaoViewController = [[TianMaoViewController alloc]init];
[self.navigationController pushViewController:tianMaoViewController animated:YES];
}
-(void)showTianMaoGuoZhiViewController
{
TianMaoGuoZhiViewController *tianMaoGuoZhiViewController = [[TianMaoGuoZhiViewController alloc]init];
[self.navigationController pushViewController:tianMaoGuoZhiViewController animated:YES];
}
-(void)showTianMaoChaoShiViewController
{
TianMaoChaoShiViewController *tianMaoChaoShiViewController = [[TianMaoChaoShiViewController alloc]init];
[self.navigationController pushViewController:tianMaoChaoShiViewController animated:YES];
}
2?單類,多接口 設計:
RouteInterface.h
#ifndef ViewControllerSplit_RouteInterface_h
#define ViewControllerSplit_RouteInterface_h
@protocol RouteInterface <NSObject>
@optional
-(void)showALiLuXingViewController;
-(void)showChongZhiViewController;
-(void)showFengLeiViewController;
-(void)showJuHuaSuanViewController;
-(void)showKouBeiWaiMaiViewController;
-(void)showLingJinBiViewController;
-(void)showTaoShengHuoViewController;
-(void)showTianMaoViewController;
-(void)showTianMaoGuoZhiViewController;
-(void)showTianMaoChaoShiViewController;
@end
#endif
ViewController.h
#import <UIKit/UIKit.h>
#import "RouteInterface.h"
@interface ViewController : UIViewController
@property (nonatomic, weak) id<RouteInterface> routeHandle;
@end
ViewController.m
-(void)showALiLuXingViewController
{
[self.routeHandle showALiLuXingViewController];
}
-(void)showChongZhiViewController
{
[self.routeHandle showChongZhiViewController];
}
-(void)showFengLeiViewController
{
[self.routeHandle showFengLeiViewController];
}
-(void)showJuHuaSuanViewController
{
[self.routeHandle showJuHuaSuanViewController];
}
-(void)showKouBeiWaiMaiViewController
{
[self.routeHandle showKouBeiWaiMaiViewController];
}
-(void)showLingJinBiViewController
{
[self.routeHandle showLingJinBiViewController];
}
-(void)showTaoShengHuoViewController
{
[self.routeHandle showTaoShengHuoViewController];
}
-(void)showTianMaoViewController
{
[self.routeHandle showTianMaoViewController];
}
-(void)showTianMaoGuoZhiViewController
{
[self.routeHandle showTianMaoGuoZhiViewController];
}
-(void)showTianMaoChaoShiViewController
{
[self.routeHandle showTianMaoChaoShiViewController];
}
3?單接口锉走,多類 設計:
RouteInterface.h
#ifndef ViewControllerSplit_RouteInterface_h
#define ViewControllerSplit_RouteInterface_h
@protocol RouteInterface <NSObject>
@optional
-(void)showViewController;
@end
#endif
ViewController.h
#import <UIKit/UIKit.h>
#import "RouteInterface.h"
@interface ViewController : UIViewController
@property (nonatomic, weak) id<RouteInterface> aLiLuXingRouteHandle;
@property (nonatomic, weak) id<RouteInterface> chongZhiRouteHandle;
@property (nonatomic, weak) id<RouteInterface> fengLeiRouteHandle;
@property (nonatomic, weak) id<RouteInterface> juHuaSuanRouteHandle;
@property (nonatomic, weak) id<RouteInterface> kouBeiWaiMaiRouteHandle;
@property (nonatomic, weak) id<RouteInterface> lingJinBiRouteHandle;
@property (nonatomic, weak) id<RouteInterface> taoShengHuoRouteHandle;
@property (nonatomic, weak) id<RouteInterface> tianMaoRouteHandle;
@property (nonatomic, weak) id<RouteInterface> tianMaoGuoZhiRouteHandle;
@property (nonatomic, weak) id<RouteInterface> tianMaoChaoShiRouteHandle;
@end
ViewController.m
-(void)showALiLuXingViewController
{
[self.aLiLuXingRouteHandle showViewController];
}
-(void)showChongZhiViewController
{
[self.chongZhiRouteHandle showViewController];
}
-(void)showFengLeiViewController
{
[self.fengLeiRouteHandle showViewController];
}
-(void)showJuHuaSuanViewController
{
[self.juHuaSuanRouteHandle showViewController];
}
-(void)showKouBeiWaiMaiViewController
{
[self.kouBeiWaiMaiRouteHandle showViewController];
}
-(void)showLingJinBiViewController
{
[self.lingJinBiRouteHandle showViewController];
}
-(void)showTaoShengHuoViewController
{
[self.taoShengHuoRouteHandle showViewController];
}
-(void)showTianMaoViewController
{
[self.tianMaoRouteHandle showViewController];
}
-(void)showTianMaoGuoZhiViewController
{
[self.tianMaoGuoZhiRouteHandle showViewController];
}
-(void)showTianMaoChaoShiViewController
{
[self.tianMaoChaoShiRouteHandle showViewController];
}
后記(下面以聊家常為主滨彻,沒時間沒興趣的朋友請直接忽略):
目前,我的行為準則只剩兩個:1?減小焦點挪蹭;2?疊加信息亭饵。據說,與王陽明的“心學”類似梁厉。
其中辜羊,疊加信息是根本,減小焦點是技巧。
任何事情的困難八秃,都是信息不足造成的碱妆。
包括所謂的行動力不足,也可以通過增加信息來解決昔驱。比如疹尾,不斷增加“行動有巨大好處,不行動將立馬毀滅”這樣的信息舍悯。
人對人的控制航棱,也是從增加單方面信息下手的。只要不停地禁止其它聲音萌衬,只允許單方面發(fā)聲,即使把更多的自由發(fā)放給人們它抱,人們還是會無可避免地按照控制者指定的方向前進秕豫。
奴役,從來都是通過信息管制來最終實現的观蓄。
而個人想自救混移,也只有從信息獲取這里下手,才能根本解決侮穿。
但是歌径,現在是一個信息爆炸的時代,全球每天有36萬7千本書出版亲茅。你是不可能全方面地獲取所有信息的回铛。
為了從世界巨量信息中拯救自己,我們只能采取收縮策略:把自己的關注點盡可能地減少縮小克锣。最好是只關注一個這個世界上除了你茵肃,沒有人會關注的點上。
然后袭祟,收集所有關于這個足夠小的點的信息验残,讓這個單點全部信息塞進大腦,反復啄磨巾乳。如果在這個足夠小的點上您没,你能更好地重組現有的信息,甚至創(chuàng)造新信息胆绊,就是對這個世界巨大的貢獻氨鹏。
分享一個TED:
http://www.miaopai.com/show/OXEFXdUIU90yduUazs1gBA__.htm