stackView Inside UiscrollView contents are being shown bigger than the device screen size in simulator - uicollectionview

enter image description here
contenst inside the UiView are tilted to both directions horizontally instead of fitting to the device' frame

Related

Apply Image in Buttons

As A Begineer I've made a Puzzle game and it's working fine in Iphone Simulators.
But problem occurred when I run it in bigger Screen like IPad Air 2.All the picture aren't fitting perfectly in the buttons
(Note that Images are applied on buttons not in the Background of
buttons)
As image size not fit to given size of button, may be due to size concern of aspect fit property of imageview of button. You can try to scale image proportionally to size of imageview of button and get desire result.
You can refer to this link for scale image as proportionally to desired size.
scale Image in an UIButton to AspectFit?

Cocoa - screen capture and draw (retina)

I`m try get screen capture from retina display, and draw this image on window.
I can get capture
CGDirectDisplayID displayId = CGMainDisplayID()
CGImage imageRef = CGDisplayCreateImage(displayId)
image have a size 2560x1600
Now, i need draw this image on window. But if, i resize window to full screen, window return size 1280x800. If i wont draw image on window, i need scale image to 1280x800. Image lost quality, this is not good.
Please help me, how i can get screen capture from retina display and draw his on window, without lost quality ?
You can find out actual window size in pixels by passing its frame to this method:
-[NSWindow convertRectToBacking:]
Just draw the image to the view's bounds. In theory this is a scaling operation, but in reality it's not because the view's bounds are in points, not pixels. The backing buffer for the view is at the same DPI as the original screen capture, so it will be a straight blit. No detail will be lost.

Does changing the frame of the view affect renderInContext and UIGraphicsGetImageFromCurrentImageContext?

I am trying to render the image of a scroll view even to the areas which is outside the visible area of the screen. I am resizing the frame of the scroll view to include the content size width and height.After resizing, I am doing a renderInContext and finally taking the image by UIGraphicsGetImageFromCurrentImageContext.
All I am getting is a square box of black color of certain bytes. If i do not resize the frame of the view, i get the image with incorrect frame.
Does changing the frame affect renderInContext? What can i do to get the correct image after resizing?

UIImageView with another UIImage of frame

i m developing an photo based app
i have two imageview one imageview contains the original image
and other imageview contains the frame
Now the problem is i want to manage the frame Imageview according to the main image
i.e. if my main image view is of size 320x480 then border applies on that size
and if my image view is of size 200x150 then border have to applies on that size
How to do that
UIImage.size can give you dimensions of image you are using. you can resize your UIImageView.frame using this size. this will fit UIImage in UIImageView without any extra space so borders will appear perfect.
second option could be to initialize an image view once again using following method.
- (id)initWithImage:(UIImage *)image
this will make a perfect sized imageview for your image.
Let me know if you are not looking for something like this....

Image size for the iPhone - Portrait vs Landscape

I have images of size 320 x 480. I left a blank space at the bottom of these images to account for the tab bar at the bottom of the iPhone screen.
The 320 x 480 looks good on the iphone in portrait mode but it looks stretched on landscape mode.
These images are loaded programmatically.
What can I do to not having them look stretched and perhaps how to use a higher resolution.
My understanding is that a higher resolution means the image will be too big for the iPhone screen.
Thank you.
I presume you are using UIImageView. By default the contentMode property of any imageView is set to UIViewContentModeScaleToFill that means it will fill the entire view thereby stretching the image.
change this to - [imgView setContentMode: UIViewContentModeScaleAspectFit], what this does is to respect the aspect ratio of the image.
more here in apple docs
The screen Size of iPhone and iPad are given below. Based on the mode you can create image size.
iPhone:
Portrait : 320x460
Landscape : 480x300
iPad:
portrait : 768x1004
Landscape : 1024x748