A: 

This should work I think:

 [element setFrame:...];

However if you work with different UI elements in your method may be you can make your elements parameter UIView* instead of id? This way your code will work for all UIView subclasses (which is what you actually need I suppose)

Vladimir
Yeah, I thought about that already. But still. Somehow it should work with id... I will try setFrame though. Thanks
jagse
That actually worked. But I dont really get whats the difference? Compiler issue, or why does this work?
jagse
Yes it is compiler issue, having only id type compiler can't determine what frame is.
Vladimir
A: 

The difference is that "id" doesn't have any kind of reference to a frame. It could be anything. You want to instead do (UIView *)element in the method declaration, or alternatively in the call to element.frame, you would do ((UIView *)element).frame.

(And yeah, all things that you put on the screen are inheriting from UIView -- UIButton, UIImageView, etc.)

Kalle
Yeah I know that. I was just wondering why id did not work. Even though it does not have a reference I thought it should be checked at compile time...
jagse
"Compile time" has no clue what kind of stuff you'll end up throwing at an id-declared argument to a method -- you, or your coworker etc.
Kalle