iphone - UIScrollview subviews show incorrect frames when enumerated -


hi guys have issue cannot head around.

i have broken down issue own project , can still reproduce it.

i have scrollview 30 uibutton layed out. (for example)

if enumerate on the subview , log frames, odd 1 have frame wasnt expected

this occurs once view has been drawn on screen

e.g

viewdidload

 [self.scrollview.subviews enumerateobjectsusingblock:^(id obj, nsuinteger idx, bool *stop) {          uibutton* view = (uibutton*)obj;          nslog(@"%@",nsstringfromcgrect(view.frame));        }]; 

log:

2012-07-04 15:46:02.939 bug scroller[2182:707] {{29, 647}, {72, 37}}

2012-07-04 15:46:02.946 bug scroller[2182:707] {{119, 647}, {72, 37}}

2012-07-04 15:46:02.950 bug scroller[2182:707] {{219, 647}, {72, 37}}

2012-07-04 15:46:02.954 bug scroller[2182:707] {{313, 453}, {7, 7}}

as can see bottom log shows completly incorrect frame origins , size.

oddly ever size of view seem size of 7.

this appear reproducable not visible on screen

what going on here , how can avoid happening?

thanks dan

try instead :

[self.scrollview.subviews enumerateobjectsusingblock:^(id obj, nsuinteger idx, bool *stop) { if([obj iskindofclass:[uibutton class]]) {         uibutton *currentbutton = (uibutton *)obj;         nslog(@"%@",nsstringfromcgrect(currentbutton.frame)); } }]; 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -