NSString-NSDate类型转换和CustomBar的总结

NSString --> NSDate:

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

[dateFormatter setDateFormat:@"yyyy-MM-dd"];

NSDate *tempDate = [dateFormatter dateFromString:@"2012-12-21"];

NSDate --> NSString:

NSDate *date = [NSDate date];

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

[dateFormatter setDateFormat:@"yyyy-MM-dd"];

NSString *dateAndTime = [dateFormatter stringFromDate: date];

今日关于自定义UITabBarController的CustomBar的类库,

遇到一系列诡异的动画效果以及之前没有注意的问题

首先,CustomBar 继承了UITabBarController

并且拥有相应的显示 和 隐藏 等方法

方法展示如下

Objectiv-c代码 :

// 隐藏tabbar

- (void) hideCustomTabBar{

for(UIView *view in self.view.subviews){

if([view isKindOfClass:[UIImageView class]]||[view isKindOfClass:[MKNumberBadgeView class]]||[view isKindOfClass:[UIButton class]]){

view.hidden = YES;

}

}

slideBg.hidden=YES;

}

Oc代码:

- (void) showCustomTabBar{

for(UIView *view in self.view.subviews){

if([view isKindOfClass:[UIImageView class]]||[view isKindOfClass:[MKNumberBadgeView class]]||[view isKindOfClass:[UIButton class]]){

// [UIView beginAnimations:nil context:nil];

// [UIView animateWithDuration:0.3 animations:nil];

view.hidden = NO;

}

}

slideBg.hidden=NO;

}

在调用上面的隐藏方法的时候,并不能将tabbar全部隐藏,还留下一条白色不可用区域(tabbar区域)。

如何将其全部隐藏呢?除了调用上述隐藏方法之外,还需要在push的时候调用

hidesBottomBarWhenPushed方法,代码如下

Oc代码:

ReadViewController *read = [[ReadViewController alloc] init];

read.hidesBottomBarWhenPushed = YES;

[self.navigationController pushViewController:read animated:YES];

[read release];

这样就能将其全部隐藏了

经验分享 程序员 微信小程序 职场和发展