Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i create a UIImage from a UIImageView?
    primarykey
    data
    text
    <p>I am trying to implement an animation set of images on my application.</p> <pre><code>NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"myImage1.png"], [UIImage imageNamed:@"myImage2.png"], [UIImage imageNamed:@"myImage3.png"], [UIImage imageNamed:@"myImage4.gif"], nil]; UIImageView *myAnimatedView = [UIImageView alloc]; [myAnimatedView initWithFrame:[self bounds]]; myAnimatedView.animationImages = myImages; myAnimatedView.animationDuration = 0.25; // seconds myAnimatedView.animationRepeatCount = 0; // 0 = loops forever [myAnimatedView startAnimating]; [self addSubview:myAnimatedView]; [myAnimatedView release]; </code></pre> <p>Ok, but the problem is that i am using an API function to place a marker on a map.</p> <p>That function is the following: </p> <pre><code>RMMarker *newMarker; UIImage *blueMarkerImage = [UIImage imageNamed:@"marker.png"]; newMarker = [[RMMarker alloc] initWithUIImage:blueMarkerImage anchorPoint:CGPointMake(0.5, 1.0)]; [mapView.contents.markerManager addMarker:newMarker AtLatLong:position]; [newMarker release]; </code></pre> <p>The problem is that "initWithUIImage:" only works with UIImage, not with UIImageView.</p> <p>So, how can i solve it??</p> <p><strong>UPDATE:</strong> My new code that is not working:</p> <pre><code>NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"marker0.png"], [UIImage imageNamed:@"marker1.png"], [UIImage imageNamed:@"marker2.png"], [UIImage imageNamed:@"marker3.png"], [UIImage imageNamed:@"marker4.png"], nil]; UIImageView *myAnimatedView = [UIImageView alloc]; myAnimatedView.animationImages = myImages; myAnimatedView.animationDuration = 10; // seconds myAnimatedView.animationRepeatCount = 1; // 0 = loops forever [myAnimatedView startAnimating]; RMMarker *newMarker = [[RMMarker alloc] initWithUIImage:[myAnimatedView image] anchorPoint:CGPointMake(0.5, 1.0)]; [mapView.contents.markerManager addMarker:newMarker AtLatLong:markerPosition]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload