dynamic - iPhone scrollView add elements dynamically with id -
I want to fill a scrollview with quite a few different UI elements. So I thought I used to write a method that remembers the current situation in the scrollview and just adds the element to the scrollview in the current state.
Like:.
- (zero) addUIElement: (id) element withWidth: (CGFloat) width andHeight: (CGFloat) height and YGap: (CGFloat) YGap {element.frame = CGRectMake (currentScrollPos.x, ( CurrentScrollPos.y + YGap), width, height); [Scroll-throughsviewview: element]; // and then set the current book position here} Unfortunately when I try to access element.frame = ..., I do not request a member in some of a structure or association. When I try to do the [element frame] = ... lvalue requires the left operability of the work as well. Now, first of all I'm not sure what the best way to do is to dynamically add a scrollview object. Perhaps someone has a better or easier view.
On the other hand, I can not find why it does not work at all! Do I have to put my element in the actual class? I thought I would not have to do this ... Besides, my method does not matter so much. Or at least a few more steps will be required ...
I think that should work :
[element setFrame: ...];
However, if you work with different UI elements in your method, can you * UIView your element parameter instead of ID? In this way your code will work for all UIView sub-squares (which is what you really want me)
Comments
Post a Comment