Using CGRectIntersectsRect with IBOutletCollection of an array of uiviews -


hello have 3 views part of iboutletcollection. in array called myarrayofviews. i'd able use cgrectintersectsrect determine when of these 3 views overlap far no luck. thought loop through array twice , run cgrectintersectsrect no luck. missing. in advance!

for (uiview *view1 in self.myarrayofviews) {     nslog(@"view1 %@",view1);     (uiview *view2 in self.myarrayofviews) {         nslog(@"view2 %@",view2);          if( cgrectintersectsrect(view1.frame, view2.frame)) {             nslog(@"overlap!");         }     }  } 

you figured out problem was. here's how add check 2 views not same:

for (uiview *view1 in self.myarrayofviews) {     (uiview *view2 in self.myarrayofviews) {             if (view1 != view2 && cgrectintersectsrect(view1.frame, view2.frame)) {             nslog(@"overlap!");         }     }     } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -