I have UIScrollView with many UIView views added to the content. I would like to convert UIView and its subviews to UIImage and I know how to do it if the UIView is currently visible on the device screen. Is it possible to convert UIView (subview in UIScrollView) into UIImage if UIView is not in UIScrollView visible rect?
Could you just iterate over all subviews taking a screenshot of each UIView inside the UIScrollView ?
The following class may help with taking screenshots:
http://ioscodesnippet.com/2011/08/25/rendering-any-uiviews-into-uiimage-in-one-line/
Hope you find a solution.
Thanks,
Michael
Related
I added UIImageView which is subview of UIScrollView. Then I added UIButton is subview of UIImageView. When I zoom UIImageView then UIButton is also perform zooming. I want only zoom UIImageView not UIButton. How can I achieve this?
Since UIButton is subview of UIImageView, it will pan/zoom when you zoom/pan UIImageView. To solve your problem, make it subview of some other view, perhaps UIScrollView in your case.
Can anyone let me know add blank UIImageView with certain height inside the UIStackView?
I cannot add an empty UIImageViews by setting its bounds to the UIStackView. But if we add the UIImage as content for the UIImageView then all the pages are added to the UIStackView which is a child of UIScrollView.
This can be achieved by setting Intrinsic Placeholder size of the UIImageView.
I have a UIScrollView which contains instances of an UIView subclass.
This UIView has a CAShapeLayer as a sublayer of its layer, and a UITextView as a subview.
With zooming enabled on the UIScrollView, the CAShapeLayer remains sharp when I zoom, but the UITextView doesn't.
Is there a way to have the UITextView redraw at the correct resolution?
you can use [yourTextView contentScaleFactor] or [yourTextView.layer contentsScale]. Set it to the current scalefactor.
Dear all,
i have UIView and UIScrollView inside UIViewController.
UIView and UIScrollView has same width, width equal 500,
I need UIView to scroll when I scroll the UIScrollView. How can I achieve this?
P.S: UIView is not a subview of UIScrollView
Thank you for answers!
If i understand correctly u need to add into ur viewControler a horizontalscroll view and then into that view and into that u add ur view and another scrollview.
I hope i understand ur question correctly.
you need to make your UIView as the subview of UIScrollView then only you will be able to scroll the UIView when you scroll your scrollview.
I need to place a photo in the screen and it should be able to be scrolled or zoomed,
I know UIScrollView does these, so I alloced one, but how about my photo?
I guess I should not just set the photo as the backgroundColor of my UIScrollView, and I haven't found any property of UIScrollView, in the document, to hold an image, such as "imageView", "contentView", or something like that.
So, what should I do to make a picture in my screen and make it able to respond to finger touches?
Thanks a lot!
Add the UIImageView to the UIScrollView and set the min/max scale value to it.
Then implement the following UIScrollViewDelegate function.
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return yourImageView;
}
If you want to have multiple items scaled, add all the view into a UIView, and put that UIView inside the UIScrollView. Of course you have to change the return view to that UIView in the above function.
Just add your UIImageView as a subview of the UIScrollView. Also, set the scroll view's contentSize property to be equal to the size of the image view's frame.
THe scrollView is the first step.
Then you should add a UIImageView and load an image inside.
You need also to set the max e min zoomScale properties of the scrollview
And you must implement the scrollview delegate method – viewForZoomingInScrollView: