UIWebView doesn't respond to touches when drawn off screen - objective-c

Ok, so I have a UIScrollView that contains several subviews, the subview I am having difficulties with is the UIWebView. When the webview is displayed on screen without having to scroll down the UIScrollView, everything works great (figure 1).
Where the problem starts is when the webview is loaded off the screen (figure 2), and scrolling is needed to view it (figure 3). The webview no longer responds to any user interaction.
I've tried some basic things like reloading the webview after the scrollViewDidEndDecelerating delegate is called, but nothing seemed to work. Has anyone encountered this before or have any suggestions on how to fix it?

Turns out this was working perfectly all along. Only problem was I had a wrapper UIView that contained the imageView and webview, but the wrapper wasn't getting resized, so touches outside its bounds weren't being respected. I just want to mention, a webview really shouldn't be placed in a scrollview. I'm only doing this because the webview is being sized according to its content and has scrolling disabled. Plus, there are currently no other views in the documentation that support links without heavy modification.

Related

Responder Chain (UIWebView inside UItableViewCell) Objective-C

I've been struggling with first responder problem. I put web controller (UIWebView) inside UITableViewCell and now I would like to scroll vertically my table and not affect UIWebView (this case may be done by disabling scrolling scrollview from UIWebView). However problem appears when user zooms into web content, then I want scroll horizontally through web content and still vertically scroll in table (cause cell will be resized to zoomed content).
There is a property called 'multipleTouchEnabled' that should disable the pinch gesture, but I think the user would still be able to double-tap (assuming the cell doesn't consume this gesture). Why not, instead of creating multiple UIWebView's (which have a large overhead) don't you create one hidden UIWebView that loads a website and caches an image, then load this image into the cell.
Ultimately, if you still wanted to use the UIWebView approach, you could probably subclass it and override hitTest/touches methods or handle the gesture recognizers yourself.
Also, if this is for iOS8 I would be using the WKWebView instead.

views, buttons in nsscrollview not appearing anymore

In my Xcode4 projects I was using the Interface Builder to add scrollviews to my xibs.
After that I could drag other buttons or views into that scrollview so that they
appeared as expected when the app started. Strangely after switching to Mavericks and Xcode5 neither the buttons nor views appear after dragging them onto the scrollview in IB. So without changes from my side the projects using scrollviews don't work correctly anymore. Before starting the app everything looks the same. In the IB Document-Outline they are shown after Clip-View. Like this: ->scrollview ->clipview ->nsview_iwant_to_add. The buttons and views are shown in the IB preview.
Anyone an idea? Should be easy to reproduce. Just drag a scrollview to a xib and drag another (colored)view/button onto that scrollview to see they're not appearing in the running application.
Solved this by adding constraints to the elements put in nsscrollview. min. width height. etc.
The problem seems to be related to the way autolayout treats objects inside the scrollview.

UIScrollView bounces on object press

I have a UIScrollView with a bunch of buttons and switches present in it. When pressing any of these items the scroll view bounces to the top of the screen. While debugging this issue I increased the content size of the scroll view to be much larger than the space that I require and the issue does not happen. I should also mention that in in the hierarchy of objects within this view controller I do not have a UIView is it possible this could be causing my problem. I have tried adding a one in but it seems to break a lot of the UIScrollView features. Does anyone have any ideas as to why this is happening or what hierarchy structure should be employed when using a UIScrollView.
Thanks.

UITableView Misalignment with Navigation Bar (cells get stuck underneath on rotate)

I'm using the new Storyboarding feature in Xcode 4.2, and I've run into a problem where my UITableView seems to forget that there is a Navigation Bar upon device rotation. When the device is rotated, the cells appear to be trapped under the Navigation Bar. This bug is driving me absolutely insane, where I might just trash the project and start over.
Since I have recently noticed this, I am not sure if it is something that I had done / misconfigured or a bug. Nevertheless, to the issue:
Images of the Issue:
The image below shows what my application looks like once loaded. Everything is aligned correctly
Once the device is rotated, the UITableView ignores the Navigation Bar and assumes its space.
The problem persists even when the device is reoriented to portrait mode.
My struts and springs in Xcode are no different from a default UINavigationController dragged out from the object library. I've even ditched my UINavigationController and reconfigured a new one.
For the record, I do NOT have my main navigation controller subclassed.
Lastly, there is a similar post on Stack Overflow, but as you can see, my Navigation Bar does resize itself correctly upon rotation.
Add this in the didRotateFromInterfaceOrientation method.
[self.navigationController.view layoutSubviews];
Looks like you have wantsFullScreenLayout = YES in the UIViewController.

Can’t tap button after interface rotation

I’ve got a view that has to be presented both in landscape and portrait. The transition between different orientations is done by repositioning and resizing the subviews. One of the subviews is a button (plain UIButton with an image background). When the interface rotates to landscape, the button starts misbehaving – it can only be tapped on its left part, the right part does not respond. When I move the button a bit to the left, the tappable part grows. The button should not be obscured by any other view, it’s clearly visible. When I override the hitTest:withEvent: method in the parent view, I see that the taps in the “numb” part of the button result in nil being returned. I think I have seen this behaviour once before, but unfortunately I’ve forgotten the source of the problem :) Any help?
Ah yes, I forgot to resize the view itself. Thus the button was on the boundary of the view and even though it was not clipped, the part lying outside the view frame was not considered for hit tests.