I want the address for each graphic component I write so I can work off of it later as it is a large matrix and I don’t want to do: “for(UIView *myView in [self.view subviews]){“. <–too slow to link and often I don’t get what I want.
However I can get the desired result by keeping the address and setting the pointer address to it, but I get a Warning:
UIView *myView = [[UIView alloc] initWithFrame:RectFrame];
address[j][i] = (int) myView;
myView = address[j][i]; // <---Assignment makes pointer from integer without a cast
Ok, so I try and cast it with (UIView) and get…
UIView *myView = [[UIView alloc] initWithFrame:RectFrame];
address[j][i] = (int) myView;
myView = (UIView) address[j][i]; // <---Conversion to non-scalar type requested
So how do I appease and clear the warning “ssignment makes pointer from integer without a cast” ??
Thank you
First off: iterating, manipulating and drawing 1000 UIViews is probably going to be unacceptably slow no matter how you do it. And I’ll bet the “drawing” part is going to be your bottleneck, so I doubt the difference between iterating through the
subviewsarray or a 2D C array will make a noticeable difference in speed.That said, to make the warning go away, declare your array as an array of
(UIView *)pointers instead ofint:Then you don’t need to do any type casting anywhere.