Go to GoReading for breaking news, videos, and the latest top stories in world news, business, politics, health and pop culture.

How to Find Where a UIIMage Is Positioned in a UIIMageView

104 11
    • 1). Open your iPhone application in Xcode and open the coding editor.

    • 2). Browse to the "UIImageView" line. A sample code is:

      CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 109.0f);
      UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
      [myImage setImage:[UIImage imageNamed:@"myImage.png"]];
      myImage.opaque = YES; // explicitly opaque for performance
      [self.view addSubview:myImage];
      [myImage release];

      The first line defines the shape and the location of the tag 'myImageRect'. In the "UIImageView" line (2), it places "myImage" in the frame "myImageRect." On the next line (3), the "UIImage" is set as "myImage.png" -- the actual image itself. Therefore, the first line designates where image will be located.

    • 3). Make any amendments necessary and save your file.

Source...

Leave A Reply

Your email address will not be published.