Draw Larger and Smaller UIImageView size when scrolling in iOS - objective-c

I have an app of photo catalog on my iPhone.
This app shows three images on screen with scrollview.
I want to enlarge/shrink the image size when I am scrolling.
I want to expand the image size when the image is centered.
And draw the image smaller when scrolled away from center to right/left.
I think this behaviour needs to developed in scrollViewDidScroll.
Do you know how to do this effect?

so you want a Coverflow ,
iCarousel may be the best control for it
take a look https://github.com/nicklockwood/iCarousel

Related

Appcelerator Studio - Don't stretch Image

I have a 405x720 image that it is to cover the background image. I've noticed that it stretches the image if the device's screen is smaller than the image. (I'm using a Galaxy S4 to test my apps).
Here's what I have so far:
var fullView = Ti.UI.createImageView({
layout: 'vertical',
width: '100%',
height: '100%',
image: '/images/background.png'
});
I've heard about the clipping technique, however that is only available for iOS and I'd like to have it for both platforms. Is there a way to do this? Or should I try to resize it appropriately? Tips/Suggestions are appreciated!
You should use proper images according to the aspect ratio of screen you are going to run your app on.
You can do this by calculating the width-height ratio of device and then you can decide which image to show on.
But putting a single resolution image directly to cover up the whole screen
is never going to work.
To resize an image, you can use Ti.Blob class' methods after fetching your image using Ti.Filesystem
Also remember that putting an image on whole background takes lot of memory especially in Android. That's why most of the apps do not use complete image to cover up background, rather they use small images wherever necessary and fills up other areas by colors or gradients as required.
But if your requirement is only to use image in background then unload it as soon as you move to different screen and load it again as you are back on it.
Further points to keep note of:
If you set bg image on a View, then it will be fit to cover the dimension of a View. So, if you have a view of width/height to 100%, then image will be fit into it. It means that image size will depend on View's dimension, not the View dimension will depend on image size.
If you set image on ImageView, and suppose you have:
ImageView width = FILL to screen size of 720, then the image height will be automatically decided to keep the aspect ratio. It means that if you have an image of size width=720 and height=400, then the ImageView will be of width=FILL & height=400
Image of size width=1000 and height=800 & ImageView height = 400, then the ImageView will be of width=500 & height=400
The problem is that you're actually telling the image control to load the image on an object that is stretched to the entire width and height of the screen - and when the screen aspect ratio is different than the one you have cropped your image by then you get bad aspect ratio and image looks screwed up.
If you remove either the width or the height, than the aspect ratio of the image will be loaded.
When I want a background image what I found the best way is to make a square image, and then set my ImageView height to Ti.UI.FILL and my width to Ti.UI.SIZE - That way it shows good aspect ratio and side that dont "fit" the screen (width or height) are not shown.

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?

Load larger image on tap of small image with animation

I'm trying to load a large version of an image in the centre of the user's screen when then tap on a smaller version of the image that's already on my view.
Ideally I want to do this using an animation to get to the new image like a vertical flip.
Also if there's a way to make the background look greyed out like it's not the foreground then that would be even better.
Here's an image of what I'm after, I'm at work at the moment so haven't got access to the actual code / images.
I'm a new user so can't add pictures. Click here if you want to see what I'm thinking.
Image
There is an KGmodal Example Exist in GitHUB hope that Might Help you.
You have to Change the content view and Add an Imageview Programatically (with required size ) in the content View.
Follow the below link: https://github.com/kgn/KGModal
For Fliping the image see the tutorial iphone Flip Image.
In the end I added the larger image on to begin with and set its alpha to 0, then added a gesture recognizer on the smaller image that animated the larger one and gradually changed its alpha to 1. The did the reverse on the large image. Don't know why I didn't think of that in the first place!

Aspect ratio in UIImageView

I got app which can add photo from camera or gallery. After adding each photo showes in UIImageView. But they show with bad aspect ratio. Photoes are extended on UIImageView's size.
How can i show photoes with their real aspect ration?
UPD and what about small pictures? if user will add really small picture, this picture will resize on all area of UIImageView. How show this pictures in real size?
Doing myImageView.contentMode = UIViewContentModeScaleAspectFit; is one option.
But it isn't enough because it changes the aspect ratio of the image, but it doesn't change the source image.
The only way to do that is to use the UIGraphicsImageContext as explained there:
Resize UIImage with aspect ratio?

iOS loss of image quality

This is the case:
I have an image. In the projects browser it looks good.
/but when I 'load' it in one of my controls the edges get rather blurry. And I'm not resizing it or anything. Why is this?
The image, unloaded:
The image when loaded in a control:
As you can see the corners get rather blurry/streched. Why?
It happened to me in the past.
Most of the time the problem is that the dimensions of the image are different from the dimensions of the controller.
Check you controller size with:
NSLog(#"controller size = %#",NSStringFromRect(your_controller.rect));
And see if it the image size fits.
I've also had this before and as #shannoga said if the dimensions of the view are different to the image it will auto stretch it.
Are you loading the image into an ImageView? if so the imageView.Mode property defaults to Scale To Fill. If you set the mode to Top, Left or Center it wont stretch the image.