0
我具有被一個的CGRect幀錯誤屬性
h文件內創建圖像的陣列:
NSMutableArray *imageArray;
.m文件:
myImage = [[UIImageView alloc] initWithFrame:myImageRect];
[imageArray addObject:myImage];
如果我直接從myImage變量調用框架,我會得到正確的值:
NSLog(@"Frame x:%f y:%f w:%f h:%f", myImage.frame.origin.x, myImage.frame.origin.y, myImage.frame.size.width, myImage.frame.size.height);
個
輸出:`幀x:226.000000 Y:226.000000瓦特:226.000000 H:334.000000``
但是,如果我通過陣列調用圖像它給我不正確的值:
UIImageView *anImage = [imageArray objectAtIndex:5];
NSLog(@"frame x:%f y:%f w:%f h:%f", anImage.frame.origin.x, anImage.frame.origin.y, anImage.frame.size.width, anImage.frame.size.height);
輸出:frame x:0.000000 y:0.000000 w:0.000000 h:0.000000
我在做什麼錯?
你的Alloc +初始化的imagArray? –
我會在@AnoopVaidya的理論上下注1美元。 – danh