Incompatible types in initialization (CGRect)

Discussion in 'iOS Programming' started by swiftd, Aug 7, 2009.

  1. swiftd macrumors newbie

    Joined:
    Jul 12, 2009
    #1
    Hey guys,

    I have an array of UIImageView called boxArray. I'm trying to use the frame attribute of the array elements in another part of the program, like so:

    Code:
    CGRect *newFrame = (((UIImageView *)[boxArray objectAtIndex:i]).frame);
    but I get the following compile error:
    error: incompatible types in initialization

    Can anyone see where I'm going wrong? Thanks for reading.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    CGRect is not an object class but a struct. So:
    Code:
    CGRect newFrame = (((UIImageView *)[boxArray objectAtIndex:i]).frame);
     
  3. swiftd thread starter macrumors newbie

    Joined:
    Jul 12, 2009
    #3
    Thanks!!
     

Share This Page