Tar*_*w45 1 objective-c uikit cocos2d-iphone ios5
从以下代码
// yPos = 0, width = 100, height = 150
[imagesMutable enumerateObjectsUsingBlock: ^(UIScrollView verticalScroll, NSUInteger idx, BOOL *stop){
[verticalScroll addSubView:[UIImageView setFrame:CGRectMake(0, yPos, width, height)]]
// some code
yPos += (height + 15)
}];
Run Code Online (Sandbox Code Playgroud)
比方说,如果imagesMutable得到3个对象.当我从某个地方读到CGRectMake正在使用笛卡尔坐标时(x = 0,y = 0将在左下角).所以,它应该是
[verticalScroll addSubView:[UIImageView setFrame:CGRectMake(0, 0, 100, 150)]]
[verticalScroll addSubView:[UIImageView setFrame:CGRectMake(0, 165, 100, 150)]]
[verticalScroll addSubView:[UIImageView setFrame:CGRectMake(0, 330, 100, 150)]]
Run Code Online (Sandbox Code Playgroud)
这应该意味着
First CGRectMake should has bottom left at (0, 0) and top right at (100, 150)
Second CGRectMake should has bottom left at (0, 165) and top right at (100, 315)
Third CGRectMake should has bottom left at (0, 330) and top right at (100, 480)
Run Code Online (Sandbox Code Playgroud)
然后,从顶部到底部的图像的顺序应该是3 - > 2 - > 1比较到imagesMutable的对象排序(1 - > 2 - > 3)
但是为什么,它以1 - > 2 - > 3的顺序出现,与我启动应用程序时imagesMutable的对象排序相同?我错过了什么吗?
| 归档时间: |
|
| 查看次数: |
9654 次 |
| 最近记录: |