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.
Related
I am trying to create the same type of slide-up/pull-up menu (from the bottom) as the Any.do iPhone app, but not having any success.
The issue I am running into is the app was built with storyboards so I am thinking I might have to scratch that idea and use just code.
Any ideas?
There is no need to get rid of your storyboard to recreate this, that's what IBOutlets are for. Any way, it looks like this was made by creating a UIScrollView that takes up the entire screen. Then add a UITableView to the upper section of the scroll view. Mind you in order for this to work, you'll need to disable scrolling on the scroll view in the background.
From there you can programmatically add the other elements to the scroll view to be rendered off screen, since there are only three they can probably just be buttons. And finally, since scrolling is disabled on the background scroll view you can add an image with a UISwipeGestureRecognizer at the bottom of the screen to manually change the scroll view's content offset property.
Does anyone know how to implement the behaviour of scrollview in iOS 6 AppStore app lists? Particularly, paging of 3,5 icons (half of icon in the right side), and when the list ends - half of the icon in the left side.
Tried so far:
1. Custom gesture recognizer (looks a bit hacky + a lot of math in the code)
2. Different configurations of scrollview and its subviews (insets, frame, content size, etc.), but it's still not working as expected
I am not 100% sure if the App Store app actually uses UIScrollView - it used to be mainly HTML based.
Regardless, you should be able to use the relatively new delegate method scrollViewWillEndDragging:withVelocity:targetContentOffset:, introduced in iOS 5. This method is designed for you to move the scroll view to a custom position once the user lifts their finger without needing to worry about deceleration / velocity (i.e, custom paging offsets). You'll need to make sure your scroll view is set not to page for this delegate method to be triggered.
Once it is triggered (when the user lifts their finger off the screen) you can calculate the required content offset and set the passed in targetContentOffset property. The scroll view will then automatically decelerate to the appropriate content offset you supplied.
I have a scrollView. Typical tableView Cell. I did things a lot on viewDidScroll.
viewDidScroll is called on 2 cases.
User scroll
Sometimes user have stop scrolling but the scrollview still scroll anyway due to momentum, bouncing, etc.
So how do I know if users are still touching the scrollView?
UIScrollView has a BOOL property named tracking that is YES while the scroll view has a touch and NO otherwise. In my testing, it is set to NO as soon as the touch ends, even if the view is decelerating (and still sending scrollViewDidScroll: to its delegate). This seems like exactly what you are asking for.
In my testing, the dragging property doesn't seem to become NO reliably while the view is decelerating after the touch ends.
The decelerating property is also unreliable in my testing. If I touch the scroll view while it is decelerating, decelerating remains YES even though the view has stopped scrolling.
The delegate's scrollViewWillBeginDragging: is called when user starts dragging and scrollViewDidEndDragging:willDecelerate: & scrollViewWillEndDragging:withVelocity:targetContentOffset:(iOS 5+ without paging enabled) is called when user lefts his/her fingers.
You may also want to check scrollViewWillBeginDecelerating: and scrollViewDidEndDecelerating:.
Ref: http://developer.apple.com/library/ios/#documentation/uikit/reference/uiscrollviewdelegate_protocol/Reference/UIScrollViewDelegate.html
At the moment I'm working on an iPad explore game which has a hexagon tile map.
I've created a UIScrollView that contains a background view (the game map) and buttons in the form of hexagons (for interaction). I add every UIButton to the view via addSubview.
But... when I add more than 100 buttons the view gets laggy (no surprise here). But what should I do to solve this?
Example:
scroll view http://img233.imageshack.us/img233/5527/screenshot2011090110353.png
Adding UIButtons isn't the way to go here. You should probably draw the "buttons" in a custom -drawRect: method and use -touchesEnded:withEvent: to decide what the user wanted to do.
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.