Category Archives: Other

7月13日锻炼

29’27“
断了3天没跑,有2天在骑车,一天骑过去一天骑回来,下了一次雨
昨天是懒没下去
今天刚下去的时候感觉很不好,跑步起来,速度一快感觉呼吸跟不上
嘴巴里有血腥味,天气有点热,开始喝水太少
运动开后慢慢恢复正常,预计30以外了,能跑到29分半有点意外
这周感觉都没睡好,身体不是太好
还是得坚持跑步
身体第一,其他都是浮云

自行车买入一周

上周六房东说房子可以续租,虽然涨了500房租,但不用搬家了
周日在家搞了一天卫生,下午突然想到,我可以买车了
跑到和平西桥的美利达,本想入手一辆勇士560,但到那边骑了一把公爵后,到手的是公爵600 2013款,2400
这一周陆陆续续的买了些装备,头盔,手套,眼镜,管包,修车套装,清洗套装等等
估计又花费了800左右
周四骑车去上了一次班,来回骑了40KM,回程的时候被淋雨了,哎
一周3200就出去了,感觉这个月又要月光了……

7月7日锻炼

28‘26“ 爽啊
今天下去了2次,每次刚下去都下雨
第二次在雨里走了一会,然后一气跑了3.5KM才开始体力跟不上
跑之前吃了点香瓜,1KM后胃隐隐作痛,慢了一会
但总体来说很爽
今天下午睡了一觉体力比较好啊

7月4日锻炼

29’44″,终于进入30分了
好几天没跑了,这一周开始节奏就乱了
周日没事起来看世界杯,周一开始项目加重
周二出去building,回来直接倒了
今天还是加班,哎
需要慢慢调整过来

objc的运行时

很多时候,程序需要做统计,或者很多页面要做一样的功能,但又不能继承同一个基类

这个时候我想到了AOP,但objc做AOP好像没有太好的方法。

找到了如下一个方法,运行时替换,太爽了。

void Swizzle(Class c, SEL orig, SEL new)

{

Method origMethod = class_getInstanceMethod(c, orig);

Method newMethod = class_getInstanceMethod(c, new);

if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod)))

class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));

else

method_exchangeImplementations(origMethod, newMethod);

}

 

隐藏Tabbar

当前页面隐藏:

- (void)setTabBarHidden:(BOOL)hidden
{
  if (self.tabBarController.tabBar.hidden == hidden) {
		return;
	}

  UIView *contentView;

  if ( [[self.tabBarController.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]] )
    contentView = [self.tabBarController.view.subviews objectAtIndex:1];
  else
    contentView = [self.tabBarController.view.subviews objectAtIndex:0];

  CGFloat height = 0.0f;
  if (hidden)
    height = contentView.bounds.size.height + self.tabBarController.tabBar.frame.size.height;
  else
    height = contentView.bounds.size.height - self.tabBarController.tabBar.frame.size.height;

	contentView.frame = CGRectMake(contentView.bounds.origin.x, 
                                 contentView.bounds.origin.y, 
                                 contentView.bounds.size.width, 
                                 contentView.bounds.size.height + self.tabBarController.tabBar.frame.size.height);

  self.tabBarController.tabBar.hidden = hidden;
}

push隐藏:

self.hidesBottomBarWhenPushed = YES;