I need to connect a UIView and a UIImage and make a UIImage out of it.

PS I need to make a unique marker on GoogleMap, as far as I read the manuals, then only UIImage can be put on the map * GMS_NULLABLE_PTR icon;
PSS Using Info is not an option, you need to make information on the map immediately, without additional clicks.

  • How about a UIImageView? developer.apple.com/library/ios/documentation/UIKit/Reference/… - Denis Kreshikhin
  • @DenisKreshikhin Yes, you can add leiba, buttons, and so on .... but in love cases you will need to connect and turn it into a UIImage because GoogleMap does not accept the UIImageView - Svyatoslav Boyko
  • How can I do more, what should I do? Do you need to convert a UIView to a UIImage? Do you need to add a UIImage to a UIView as a subview? it is possible as more details, such as this and this, it is necessary in this format - Max Mikheyenko
  • @MaxMikheyenko I have certain fields that need to be displayed directly on the map. As an example, the name of a person. But without using Info, because it appears by pressing. Actually, in UIView or UIImageView, I will add the necessary UILabel (addSubview) and a picture, this is not a problem. Further, all this construction must be converted to a UIImage in order to add to GoogleMap as a marker. marker.icon = customMarker.image This .icon itself is a UIImage * GMS_NULLABLE_PTR icon; And this is my whole problem. - Svyatoslav Boyko

1 answer 1

Here so offer on English-speaking WITH

#import <QuartzCore/QuartzCore.h> + (UIImage *) imageWithView:(UIView *)view { UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage * img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return img; }