ios - Why are my CGPoints all returning as {0,0}? -


i trying store locations of 10 uiimages have stored within uicollection , placed using interface builder. trying using view.center cgpoints returning {0,0} when logged.

another strange thing set break point on loop, 2 {0,0} values returning prior loop beginning.

code:

- (void)viewdidload {     dealerbtnorigins = [[nsmutablearray alloc] init];         nsvalue *point;         cgpoint cgpoint;         (int = 0; < 10; i++)         {             cgpoint = ((uiimageview *)[dealerbtns objectatindex:i]).center;             point = [nsvalue valuewithcgpoint:((uiimageview *)[dealerbtns objectatindex:i]).center];             nslog(@"%@", nsstringfromcgpoint(cgpoint));             nslog(@"%@", nsstringfromcgpoint(point.cgpointvalue));             [dealerbtnorigins addobject:point];         } } 

your collectionview hasn't rendered yet in viewdidload. place code in viewwillappear or viewdidappear after have created collectionview coors show.


Comments

Popular posts from this blog

Java sticky instances of class com.mysql.jdbc.Field aggregating -