呜呜 写的代码被弃用了 放到这里 留个纪念
2013-01-10 11:58
162 查看
//制作cell行高
- (void)calCellHeight
{
for (int i = 0;i < _displayPictureArray.count;i++)
{
CGFloat firstColHeight = PERSONAL_PICFLOW_GAP;
CGFloat secondColHeight = PERSONAL_PICFLOW_GAP;
//cell的布局设置
CellLayoutSetting * cellLayoutSetting = [[CellLayoutSetting alloc] init];
PersonalPicDisplayData * tmpPicDisplayData = [_displayPictureArray objectAtIndex:i];
for (int j = 0; j < [tmpPicDisplayData.displayPicArray count]; j++)
{
SmallPictureData * tmpPictureData = [tmpPicDisplayData.displayPicArray objectAtIndex:j];
//测试用模拟数据
tmpPictureData.smallPicHeight = arc4random() % 60 + 40;
tmpPictureData.smallPicWidth = arc4random() % 40 + 40;
//根据比例计算要显示的高度
CGFloat perPicHeight = tmpPictureData.smallPicHeight * PERSONAL_PICFLOW_WIDTH *(1.0f) / tmpPictureData.smallPicWidth;
//测试用模拟数据
[cellLayoutSetting.picHeightInCell addObject:[NSString stringWithFormat:@"%f",perPicHeight]];
NSLog(@"%@",cellLayoutSetting.picHeightInCell);
if(j == 0)
{
firstColHeight = perPicHeight + PERSONAL_PICFLOW_GAP;
}
else
{
if (firstColHeight < secondColHeight)
{
firstColHeight = firstColHeight + perPicHeight + PERSONAL_PICFLOW_GAP;
}
else
{
secondColHeight = secondColHeight + perPicHeight + PERSONAL_PICFLOW_GAP;
}
}
}
cellLayoutSetting.cellHeight = (firstColHeight > secondColHeight) ? firstColHeight:secondColHeight;
//保存每个cell的高度及其内部所有图片的尺寸大小
[picPageLayoutSetting addObject:cellLayoutSetting];
[cellLayoutSetting release];
}
//同步数据之后 dateTableView开始重新进行加载
[self.dateTableView reloadData];
}
//makeCell atIndex
PicFlowColArray * firstColArray = [[PicFlowColArray alloc] init];
PicFlowColArray * secondColArray = [[PicFlowColArray alloc] init];
firstColArray.originY = PERSONAL_PICFLOW_GAP;
secondColArray.originY = PERSONAL_PICFLOW_GAP;
for (int i = 0; i < [cellLayoutSetting.picHeightInCell count];i++)
{
CGFloat height = [[cellLayoutSetting.picHeightInCell objectAtIndex:i] floatValue];
if(i == 0)
{
UIImageView * iv = [[UIImageView alloc] initWithFrame:CGRectMake(PERSONAL_DATE_WIDTH + PERSONAL_PICFLOW_GAP, PERSONAL_PICFLOW_GAP, PERSONAL_PICFLOW_WIDTH,
height)];
iv.backgroundColor = [UIColor yellowColor];
firstColArray.originY = firstColArray.originY + height + PERSONAL_PICFLOW_GAP;
[tmpCell addSubview:iv];
[iv release];
}
else
{
if (firstColArray.originY > secondColArray.originY)
{
UIImageView * iv = [[UIImageView alloc] initWithFrame:CGRectMake(PERSONAL_DATE_WIDTH + PERSONAL_PICFLOW_GAP * 2 + PERSONAL_PICFLOW_WIDTH,
secondColArray.originY, PERSONAL_PICFLOW_WIDTH, height)];
iv.backgroundColor = [UIColor yellowColor];
secondColArray.originY = secondColArray.originY + height +PERSONAL_PICFLOW_GAP;
[tmpCell addSubview:iv];
[iv release];
}
else
{
UIImageView * iv = [[UIImageView alloc] initWithFrame:CGRectMake(PERSONAL_DATE_WIDTH + PERSONAL_PICFLOW_GAP, firstColArray.originY, PERSONAL_PICFLOW_WIDTH,
height)];
iv.backgroundColor = [UIColor yellowColor];
firstColArray.originY = firstColArray.originY + height +PERSONAL_PICFLOW_GAP;
[tmpCell addSubview:iv];
[iv release];
}
}
}
[firstColArray release];
[secondColArray release];
- (void)calCellHeight
{
for (int i = 0;i < _displayPictureArray.count;i++)
{
CGFloat firstColHeight = PERSONAL_PICFLOW_GAP;
CGFloat secondColHeight = PERSONAL_PICFLOW_GAP;
//cell的布局设置
CellLayoutSetting * cellLayoutSetting = [[CellLayoutSetting alloc] init];
PersonalPicDisplayData * tmpPicDisplayData = [_displayPictureArray objectAtIndex:i];
for (int j = 0; j < [tmpPicDisplayData.displayPicArray count]; j++)
{
SmallPictureData * tmpPictureData = [tmpPicDisplayData.displayPicArray objectAtIndex:j];
//测试用模拟数据
tmpPictureData.smallPicHeight = arc4random() % 60 + 40;
tmpPictureData.smallPicWidth = arc4random() % 40 + 40;
//根据比例计算要显示的高度
CGFloat perPicHeight = tmpPictureData.smallPicHeight * PERSONAL_PICFLOW_WIDTH *(1.0f) / tmpPictureData.smallPicWidth;
//测试用模拟数据
[cellLayoutSetting.picHeightInCell addObject:[NSString stringWithFormat:@"%f",perPicHeight]];
NSLog(@"%@",cellLayoutSetting.picHeightInCell);
if(j == 0)
{
firstColHeight = perPicHeight + PERSONAL_PICFLOW_GAP;
}
else
{
if (firstColHeight < secondColHeight)
{
firstColHeight = firstColHeight + perPicHeight + PERSONAL_PICFLOW_GAP;
}
else
{
secondColHeight = secondColHeight + perPicHeight + PERSONAL_PICFLOW_GAP;
}
}
}
cellLayoutSetting.cellHeight = (firstColHeight > secondColHeight) ? firstColHeight:secondColHeight;
//保存每个cell的高度及其内部所有图片的尺寸大小
[picPageLayoutSetting addObject:cellLayoutSetting];
[cellLayoutSetting release];
}
//同步数据之后 dateTableView开始重新进行加载
[self.dateTableView reloadData];
}
//makeCell atIndex
PicFlowColArray * firstColArray = [[PicFlowColArray alloc] init];
PicFlowColArray * secondColArray = [[PicFlowColArray alloc] init];
firstColArray.originY = PERSONAL_PICFLOW_GAP;
secondColArray.originY = PERSONAL_PICFLOW_GAP;
for (int i = 0; i < [cellLayoutSetting.picHeightInCell count];i++)
{
CGFloat height = [[cellLayoutSetting.picHeightInCell objectAtIndex:i] floatValue];
if(i == 0)
{
UIImageView * iv = [[UIImageView alloc] initWithFrame:CGRectMake(PERSONAL_DATE_WIDTH + PERSONAL_PICFLOW_GAP, PERSONAL_PICFLOW_GAP, PERSONAL_PICFLOW_WIDTH,
height)];
iv.backgroundColor = [UIColor yellowColor];
firstColArray.originY = firstColArray.originY + height + PERSONAL_PICFLOW_GAP;
[tmpCell addSubview:iv];
[iv release];
}
else
{
if (firstColArray.originY > secondColArray.originY)
{
UIImageView * iv = [[UIImageView alloc] initWithFrame:CGRectMake(PERSONAL_DATE_WIDTH + PERSONAL_PICFLOW_GAP * 2 + PERSONAL_PICFLOW_WIDTH,
secondColArray.originY, PERSONAL_PICFLOW_WIDTH, height)];
iv.backgroundColor = [UIColor yellowColor];
secondColArray.originY = secondColArray.originY + height +PERSONAL_PICFLOW_GAP;
[tmpCell addSubview:iv];
[iv release];
}
else
{
UIImageView * iv = [[UIImageView alloc] initWithFrame:CGRectMake(PERSONAL_DATE_WIDTH + PERSONAL_PICFLOW_GAP, firstColArray.originY, PERSONAL_PICFLOW_WIDTH,
height)];
iv.backgroundColor = [UIColor yellowColor];
firstColArray.originY = firstColArray.originY + height +PERSONAL_PICFLOW_GAP;
[tmpCell addSubview:iv];
[iv release];
}
}
}
[firstColArray release];
[secondColArray release];
相关文章推荐
- hdu oj 1010 老是超时 先放到这里 参考别人ac代码
- 发现国内也有好的代码托管 所以决定把博客放到这里 谢谢
- 今天为了解决编码的问题,整理了一些代码放到这里!
- [置顶] 曲线来了,这里直接贴代码和github地址
- 这里是MYSQL操作的C语言代码,我贴几个,你们看吧2222222
- windows下的代码放到ubuntu上每行末尾都有^M
- 将自己写的Python代码打包放到PyPI上
- 请问有没有人知道可不可以根据已经编译好的exe(这里具体指窗体),通过什么工具可以看到它里面的某一个控件的事件里面的代码(比如timer的tick)。
- javascript与cs代码互相调用 asp.net中前台javascript与后台C#交互 这里主要包括了javascipt与后台CS代码四种方法互调(其中包括函数与变量的访问)
- centos7上使用git命令把代码放到github上
- Smarty模板Windows下写代码 放到CentOS6.5无法正确解析
- xcode下编写的代码放到visual studio 2012下运行报错
- 放到redis后台代码
- ”炮灰“团队自主开发,未参考任何Ftp搜索引擎代码,留个纪念。
- 发送http请求(多用途测试,这里用以测试cookie) ,java代码测试例子
- ZOJ 1952( Dijkstra )要求卡车的最大载货量,即是求dist[]的最小值这里关键是把字符串转化为数字存储在邻接矩阵cost[][]中.开始看了党姐的代码不懂,又看了一遍,大悟!
- 怎么将博客地图放到这里来啊,大家帮忙哦
- 这里是MYSQL操作的C语言代码,我贴几个,你们看吧333
- JS表情替换代码,这里使用字符代替图片路径
- Spring的JDBCTemplate的基本代码操作,这里没用c3p0连接池,用的自带连接池。