This is a very simple ViewController. I have an imageView inside a scrollView. Using autolayout I set scrollview's constraints to its view's edges. Also, imageView mode is AspectFit.
The image is provided at runtime, and it may be a landscape or portrait size. When I run the app, the image doesn't fit the current screen size. It seems that scrollView's boundaries are not being honored, thus only part of the image is being displayed. It used to work on ios7 and xcode5, but it's broken for ios8 xcode6.
Any ideas? I need to keep the use of autolayout whenever possible.
Your going to set the imageviews horizontal constraints and pin them to self.view (the scrollviews parent view) instead of the scrollview.
There is a good example of this here:
Using UIScrollView with Auto Layout in iOS
Try this to zoom out completely
[self.scrollView zoomToRect:self.imageView.frame animated:YES];
Have you tried a call to imageView.sizeToFit() in viewDidLoad? My impression is that imageView's size is fluid until the outlets are set. A call to sizeToFit forces the issue.
Related
Got another issue with UISplitViewContoller on iOS 8.
When in portrait, and the displayMode is UISplitViewControllerDisplayModePrimaryOverlay, when you rotate to landscape the secondary view controller's view doesn't resize correctly during the rotation animation. Once the rotation is done, the size is adjusted to fit the screen space and it snaps into place which is quite jarring.
However, if the display mode is UISplitViewControllerDisplayModePrimaryHidden when the rotation occurs, the secondary view's size is adjusted during the rotation animation and everything looks and works as expected.
This occurs even with the out of the box Master-Detail template project from Xcode 6.1.
Any thoughts on how to get the secondary controller's view to size correctly during the animation when the primary overlay is visible?
I have a NSView with three NSImageView subviews. I'm having trouble with the subviews clipping when I use CATransform3DMakeTranslation to translate along the x axis.
I primarily do iOS development and this is my first go in this realm. Any help would be greatly appreciated.
I ended up having to turn the Core Animation Layer on for the content view of my window. I found the answer here: How to make NSView not clip its bounding area?
I'm a web dev guy. The overflow:hidden CSS property tells the render engine to not draw the current view's content across the parent's borders.
In my current project, I have a custom NSWindow with a custom NSView with rounded corners by using NSMakeRect, overwriting drawRect: and so on. A WebView inside the NSView is strechted across the entire NSView frame.
Now the WebView 'overflows' the rounded corners of theNSView`. What I do like to have is that the WebView has the same mask as the NSView.
How would you do that?
Also make sure your view sets clips subviews to true. As far as I understand you, this is what you are looking for, and prevents f.ex. images to reach out of the parent view.
[self.view setClipsToBounds:YES];
You can set a corner radius to the layer of a view.
myView.layer.cornerRadius = 5.0f;
You'll have to add QuartzCore.framework.
I'm adding a CATiledLayer backed UIView in UIScrollView.
When the view is first loaded, I'm trying to fit the UIView, by setting the zoomScale of UIScrollView - this fits the UIView and the layered contents.
I'm having a method to fetch the tiles of image and I'm rendering them in drawLayer:inContext:
Now even if the contentsize of scrollview/frame of CATiledLayer view is greater than UIScrollView, it doesn't scroll initially.
The moment I try to zoom by pinching the screen, I'm able to scroll perfectly.
I can't scale the CGContext in drawLayer:inContext, since the context I receive is of a tile and not whole image and I have 20 tiles which make up my image.
At the end of the initWithFrame of the PDFScrollView i added the line:-
self.zoomScale = 1.0;
This worked for me.
The code is pretty much doing the same stuff as apple example
http://developer.apple.com/library/ios/#samplecode/ZoomingPDFViewer/Introduction/Intro.html%23//apple_ref/doc/uid/DTS40010281-Intro-DontLinkElementID_2
which also doesnt scroll on loading
How to put overlay view (NSImageView) and keep it at the top in front of a WebView ( which runs core animation or )?
Standard ordering in interface builder does not help.. imageview is shown in front of the webview but when i load the contents of webview with a tag or only just an html opacity animation, suddently webview takeovers the top position and shows over the imageview.
Can't i do this?
although two years passed, maybe this is solved by yourself or it no longer exists as a problem, i think an answer for this should be helpful for future viewers here :)
after found this question (even without replies below) http://www.cocoabuilder.com/archive/cocoa/223499-core-animation-how-to-swicth-off-all-implicit-animations.html I found this single line
[imageView setWantsLayer:YES];
will do the job. its because "a WebView seems to be using Core Animation layer-backed views"