SCROLLVIEW minimum zoom size - iphone

guys.i'm new to iphone.i run the zoomingpdfview demo,everthing is fine,except that i don't want the pdf is zooming out smaller than the screen's size,or even very small..
i've tried many ways,but still can't.
so,how can i achieve that goal?thanks in advance.,any advice will be gratefull.

There's a property on a UIScrollView called minimumZoomScale. However, this isn't measured in pixels, it's measured as a factor of the size of the view.
You will need to calculate the min zoom yourself i.e.
// for a pdf width 230 and screen width 360 your min zoom would be 2.0
// a pdf width 720 and screen width 360 your min zoom would be 0.5
// So, to set the zoom for a scroll view
[myScrollView minimumZoomScale:screenWidth / pdfWidth];
However, you might have to calculate this for each visible page - pdfs can have pages of different size :)

Related

How to Calculate the Height and Width of Forms in Powerhsell?

Can someone help me in understanding how to calculate the Height and Width of a Powershell Forms. For Example I Created a blank Powershell form of Height 500 and Width 700 and now If want to place a Text box a little below from the top of the form what will be the height and width that I need to enter? and If I want to place a Button at middle of the Form? what will be the height and width that I need to enter? I am struggling with this calculation.
You should get the screen size and use the ratio to set position. The ratio is useful for different screen size.

Calculating height of an object in an image giving more error percentage than calculating width

My application’s requirement is to measures object of interest’s height and width from the captured image.
I am thinking of implementing formulae behind scantips website.
I was checking the accuracy of scantips and found that width measurement is more accurate than height.
I entered iPhone 7’s focal length 3.99 and crop ratio as 28/3.99 = 7.0175438596. 28 is focalLenIn35mmFilm. I got this info from captured image’s EXIF data.
I entered the image height, height of object in image and manually calculated distance from that object.
Observation: Height is giving more error percentage than width. Width’s error percentage is around 2-4% but height’s is more than 10%.
Any pointers in the right direction will helps a lot.

Autolayout Contraints for a View from XIB

I am loading a view (shaped a circle) from a circle. I want to make sure, the circle's size adapts to various screen sizes. So far I tried placing the view inside another view, pinning the margins to the superview and then setting the superview's aspect ratio to 1:1. This gives me a circle. However, now, I want to change its size. Currently, the superview's size is specified by another subview in it, a label. Depending on the contents of the label, the superview's size changes (I have set the label's font size to Autoshrink). If I try to add a constant to the margin constraints it works, but looks the same size across different screen sizes. Also, I tried adding a multiplier, while the multiplier works for trailing and bottom margins, top and leading margins don't get affected by setting the multiplier. Below is a screenshot of the IB (Today View is the shape in the question).
You have a good start - aligning both center X & Y, 1:1 ratio. All you need to add is two sets of top/bottom and leading/trailing constraints with different priorities. Here's an example, which combined with the three constraints you have, would center a view in all orientations with a 10 point border along the narrower axis:
Priority == 750
Top == 10 points
Bottom == 10 Points
Leading == 10 points
Trailing == 10 points
Priority == 1000
Top >= 10 points
Bottom >= 10 Points
Leading >= 10 points
Trailing >= 10 points
You may see errors/warnings while doing this because IB doesn't know how to render it, but once you've completed this, you'll have what you need.
EDIT:
From memory, there are points and pixels. When and where possible, try to think in terms of points. About the only time you may wish to think in terms of pixels is with images. (There may be other measurements of graphics, but again, I'm writing from memory.)
Points should be consistent across device size - so if you have a 100x100 square in a 4 inch iPhone screen, it will be the same size on a 12.9 inch iPad Pro.
More importantly, the margins can be set the same using auto layout. A 25 point margin will be the same on both of those screen. So in my example above, you will get pretty much the largest rectangle possible across all devices since you are setting margins, not view size.
I did a dive into screen sizes last year, and these are the current screen sizes:
//iPad Pro 1366x1024
//iPad 1024x768
//iPad Mini 1024x468
//iPhone 6 Plus 736x414
//iPhone 6 677x375
//iPhone 5 568x320
//iPhone 4 480x320
So based on this the above constraints would yield a 300x300 square on an iPhone 4 (iPhone SE also) as the narrowest axis will be 320 less two 10 point margins. And on an iPad Pro 12.9 inch it will be a 1004x1004 square.
When you create constraints in code, you can also create a layoutMarginGuide with this code:
let margins = view.layoutMarginsGuide
This should be the same thing as keeping the "contain to margins" checkbox checked in IB. Essentially this is the recommended size of margins for each device. (I believe this should also include the status bar, tab and navigation bars, and even the iPhone "phone call top banner (sic)". But I've had some issues with this so YMMV.)
EDIT 2:
Putting this all together, what you are defining through "auto layout" is a very fluid way of maximizing the size of a square (or in your case, a square turned into a circle). By setting two sets of margins, one set equal to but with a high priority, you are letting auto layout know that it may break this over required constraints. The second set with greater than or equal to values is required.
Thus, in a 480x320 device, the top/bottom margin constraints that cannot be met ("equal to") can be broken, and in landscape the leading/trailing ones that cannot be met will be broken. Remember, you already set the center X/Y, so the view will be centered, and you set the 1:1 ratio so it will be square. (As long as you did not touch the priorities - the default is required.

Adjusting jssor slider size

I need to adjust the width and height to the width and height of my div which is width:250px height 170:px. I am using jssor slider and it keep giving me a full stretched width img Please kindly help me with this. this is the code below.
jssor_slider1_starter('slider1_container');
Please use $FillMode option.
var options = {
...
$FillMode: 2, //[Optional] The way to fill image in slide, 0 stretch, 1 contain (keep aspect ratio and put all inside slide), 2 cover (keep aspect ratio and cover whole slide), 4 actual size, 5 contain for large image, actual size for small image, default value is 0
...
};
Reference: http://www.jssor.com/development/reference-options.html

UIWebview can not display some large size image?

what's biggest size image can UIWebview handle?
the origin image size is: width 700 pixels, height 6900 pixels, And uiwebview display nothing.
iOS has the 3MB size limitation. the image size (width x height) must less than 3 * 1024*1024
I've discovered from some testing a limit on my html5 canvasses of 768*4096, or 3MB at 1 byte per pixel. The same resolution is enforced for images, as its not the original image size that matters, but the size of the bitmap that is rendered on the screen..