iPhone官方SDK:如何隐藏UINavigationBar

隐藏:

[self.navigationController setNavigationBarHidden:NOanimated:YES];

显示:

[self.navigationController setNavigationBarHidden:YESanimated:YES];

隐藏返回键
self.navigationItem.hidesBackButton = YES;


在手势代理方法里加以判断

- (BOOL)gestureRecognizer:(UIGestureRecognizer*)gestureRecognizer shouldReceiveTouch:(UITouch*)touch

{

return!([touch.viewisKindOfClass:[UIControlclass]]);

}

uilabel添加点击事件

UITapGestureRecognizer*tapGestureTel = [[[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(teleButtonEvent:)]autorelease];

[telephoneLabeladdGestureRecognizer:tapGestureTel];



collectionView

/*------------类目详细列表----------*/UICollectionViewFlowLayout*flowLayout=[[UICollectionViewFlowLayoutalloc]init];//flowLayout.itemSize=CGSizeMake(63,75);//三列的flowLayout.itemSize=CGSizeMake(100,120);flowLayout.scrollDirection=UICollectionViewScrollDirectionVertical;//滚动方向的设置--垂直//flowLayout.scrollDirection=UICollectionViewScrollDirectionHorizontal;//滚动方向--水平flowLayout.minimumLineSpacing=10;self.collectionView=[[UICollectionViewalloc]initWithFrame:CGRectMake(95,108,215,426)collectionViewLayout:flowLayout];self.collectionView.backgroundColor=[UIColorwhiteColor];self.collectionView.delegate=self;self.collectionView.dataSource=self;//self.collectionView.showsHorizontalScrollIndicator=NO;//隐藏水平滚动条self.collectionView.showsVerticalScrollIndicator=NO;//隐藏垂直滚动条[self.collectionViewregisterClass:[MyUICollectionViewCellclass]forCellWithReuseIdentifier:@"aaa"];[self.viewaddSubview:self.collectionView];[flowLayoutrelease];[_collectionViewrelease];



NSNumber*time=listModel.lastUptrackAt;NSDate*date=[[[NSDatealloc]initWithTimeIntervalSince1970:[timedoubleValue]/1000.0]autorelease];//把毫秒的时间转化成时间NSDateFormatter*dateFormatter=[[[NSDateFormatteralloc]init]autorelease];dateFormatter.dateFormat=@"yyyy-MM-dd";NSString*date2=[dateFormatterstringFromDate:date];//把时间进行格式化cell.labelTime.text=[NSStringstringWithFormat:@"最后更新:%@",date2];





ios设置tableview默认选中第一行并实现点击第一行的效果

//如果有数据,默认选中第一行并请求第一行的数据if(self.tableViewData.count>0){[self.tableViewselectRowAtIndexPath:[NSIndexPathindexPathForItem:0inSection:0]animated:YESscrollPosition:UITableViewScrollPositionTop];//设置选中第一行(默认有蓝色背景)[selftableView:self.tableViewdidSelectRowAtIndexPath:[NSIndexPathindexPathForItem:0inSection:0]];//实现点击第一行所调用的方法}