New Youtube embed options aspect ratio - youtube

I'm embeding this video http://www.youtube.com/watch?feature=player_embedded&v=kzsBCriOrh8 on a site but I'm getting a square aspect ratio. As you can see, in Youtube the aspect ratio is widescreen with black bars to the sides. I want this same behavior when I embed the video.
I'm following the new embed params http://code.google.com/apis/youtube/player_parameters.html
I can't seem to find any option that I can add to this to control aspect ratio
&iv_load_policy=3&rel=0&autohide=1&showinfo=0&theme=light&color=white&wmode=Opaque
Any ideas?
EDIT:
I solved it!
http://support.google.com/youtube/bin/answer.py?hl=en&answer=146402
And I also added a fixed width and height in my js script. It works.

I solved it! http://support.google.com/youtube/bin/answer.py?hl=en&answer=146402. And I also added a fixed width and height in my js script. It works.

The height and width are controlled by the height and width properties on the iframe that is used to embed the video.

Related

Image Resizing for different screens XCode

I've been trying to find a solution to this problem for a long time but I haven't been able to solve it. How do I make an image appear smaller so it would fit the screen on a smaller device? When I have in on a larger device it fits fine but when switched to a smaller screen the images start to overlap.
Example of images overlapping
I would really appreciate the help. Thank You!
Use auto layout and set your Uiimageview aspect ratio to 1:1
There are a lot of ways. Some are mentioned below:
Using Auto layout
connect every image to side of main view and set their widths and height ratio 1:1 , also set their width proportional to main view widht.
using stackviews and autolayout
1st set images width proportional to main view width
then set their aspect ratio 1 : 1
then add the columns to 2 vertical stack views and add both columns to horizontal stackview.
set the left right and bottom constraint of final stackview
You can use auto resizing as well, but that is not totally reliable.
autoresizing is default behavior of view. In your case you have to set flexible width and height of each image

Auto Layout Issues Xcode 8

I've been working on an app page in the iPhone 7 view of the latest version of Xcode. I got everything working and looking well and then when I went to the iPad view, everything was stretched out and looked awful. I reseted the auto layout and added different constraints and nothing will work. The bigger the screen is, the more stretched out some of the images become, while other are perfectly good. What am I doing wrong and what can I do to fix this issue?
If your requirement is to keep the image in the middle I suggest that you don't use any of the pin constraints. Instead select the align constraints and align the image vertically/horizontally in the view.
What's happening here is that the images are pinned to the edges of the view and when you choose a wider device the images are stretched so as to maintain the pin constraints. That's not what you would want to do.
Hope this helps.
You might want to set the Content Mode of your ImageViews to Aspect Fit:
An Aspect Ratio Constraint is not needed. A Leading, Top and Center Constraint should be enough.
Add Aspect Ratio.connect image to view aspect ratio.next add the align constraints and align the image vertically/horizontally in the view.

How to make iOS ImageView full match window?

I am new in iOS , I am an android developer self-learing iOS just for fun.
As you can see from the picture , I want to make my ImageView full-displayed in the window in different inch iPhone.
If you are an android developer, you may know what I mean is how to make ImageView match_parent in both width and height?
You must set the UIImageView Constraints, like this to adjust in the full screen, 0 spacing in all sizes, and click in Add 4 Constraints
After that, you must check in the UIImageView settings the mode to Aspect Fit, so it will keep the aspect ratio of your image.
I Took the image from your print, here is the expected final result.
Pin the image view on all four sides to its superview via constraints with a constant of zero. Now configure the image view's content mode so that it doesn't distort the image, but rather keeps its aspect ratio (there are two ways to do this, and I don't know what one you want, so you will have to experiment).

Position is ambiguous for image view

I'm just following the tutorial from Apple, and I get an error when I set the ratio 1:1 to the image view:
I think it's because the tutorial is for xCode 7, so how to fix it ?
From the snapshot you provided, you were not using Stack View, so you probably were following the older tutorial.
I also had this problem when I was following apple's tutorial, and it turned out that I placed the image view out of my Stack View, which gives me the error you mentioned; and more importantly, when I tested the app and chose an image, the image was displayed at its original size.
So the solution for me is simple: placing image view into the Stack View, as shown below:
You need to set all the constraint for the ui elements. Aspect ratio isn't enough, you should set the x and y position too for that image. (e.g.: leading space to View and top space to Button)
If you want to use auto layout, you should allways set all the constraints for all the elements.
EDIT - for better understanding
Just setting the aspect ratio for a view isn't enough. You should give other position and size data too.
In this example, the Leading Space to: Superview set the X coordinate. The Top Space to Top Layout Guide set the Y coordinate. After that we set aspect ratio, and width, or height data for the view. Like the image below.
For better understanding I recommended you to check Stanford iOS developer lessons in iTunesU. Thats will help you understand auto layout.

UIImageView isn't showing completely on 3,5 screen

I'm trying to show an UIImageView with images on my iPhone 4, but this doesn't appear completely. The bottom part is hidden...this is the result:
I have tryed with 0 constraints on left, right, top and bottom margins but no effect...
Also adding width to 320 but the height is allways 568px (4 inch screen height )
Is not an image aspect problem. I'm using Aspect FIll for this case and works good, but the imageView height is always 568px. If I resize manually the heigth to 480px the image is OK.
Thanks a lot! I don't know what can I do...
try to use this,
[imgView setContentMode:UIViewContentModeScaleToFill]
You need to set the aspect ratio of the image.
If you are using storyboard follow this link to set aspect ratio
aspect-ratio-of-image
Aspect ratio can be changed as described in Resize UIImage with
aspect ratio?
Hope this helps.
Delete the constraint which forces the height to 568px. And Add constraint for left, top, right, bottom, margins with value 0.
Don't set frame programatically , if you set 568px height, it will take for both 4inch and 3.5.
just drag and drop the image view in to storyboard view. from Xcode5 autoLayout is there. Adjust autolayout.
autolayout will automatically fit the frames.
AutoLayout Apple Library
you set autosizing
you select image then set like below imgae
[imgView setContentMode:UIViewContentModeScaleToFill]
it working iphone 5 or 4

Resources