now,i have a UIWebview inside a uiscrollview,i want to detect single tap on uiscrollview,but i have no idea to achieve it!it's so boring!
I would strongly suggest using the MGBox2 controls for your scrollview https://github.com/sobri909/MGBox2. They have an excellent wrapper for a scrollview which exposes tap events easily for the scrollview and the contents thereof.
You would place your UIWebview in an MGBox and add the MGBox to your MGScrollView.
It would then work like this:
myScrollView.onTap =^{[self doThisOnTap];};
Related
I use Xamarin.Forms, ScrollView, I can change ScrollView.Background, but background color of scroll bar don't change. How I can do it ?
Can I make a universal shared style scrollbar for all platforms?
If you can not, can I make so that I could use ScrollView in Shared project Xamarin.forms but at the same time that it is displayed at
on different platforms with their own style?
Maybe it can be done without their own styles and somehow easier? I need only custom scrollbar color in ScrollView Xamarin.Forms.
I googled but found no examples of the using color of scrollbar Xamarin.forms.
if it is not very easy to do, I would like to use an example code.
The Xamarin.Forms ScrollView control translates to a native scroll control on each platform. What you need to do, is create a custom Effect that gives you access to those underlying controls. From there you can customize the appearance of the scrollbar.
On Android, you need to work with android.widget.ScrollView. You should define a custom drawable for the scrollbar in your resources folder and programmatically change the scrollbar to that inside your effect. There are quite a few answers on StackOverflow that show you how to do it, for example here and here.
On iOS, the native control is UIScrollView from UIKit and the scrollbars are predefined images so you'll probably need to replace the image each time the control updates. Take a look here for a good starting point.
In the end, you'll have something like this in your XAML:
<ScrollView>
<ScrollView.Effects>
<local:ScrollBarColorEffect ScrollBarColor="Green" />
</ScrollView.Effects>
...
The question is very simple, how to enable scroll and zoom inside a UIScrollView in tvOS?
I tried the same initializer code from iOS and returned the scrollview for the focusedView var, but nothing happens when i touch the remote.
Also, i tried to add another custom UIPanGestureRecognizer to the scrollview and actually it works, but i don't want to handle the pan with custom code, just use the same pan behavior like iOS.
Let me know, thanks.
You can configure the scroll view's built-in pan gesture to recognize touches on the Siri Remote. It doesn't do that automatically, because normally scroll views on tvOS aren't scrolled directly by touches: they're scrolled automatically as focus moves between views within the scroll view.
If you really want the scroll view to move directly from touches, you'll need to add UITouchTypeIndirect to the allowedTouchTypes of the scroll view's panGestureRecognizer:
scrollView.panGestureRecognizer.allowedTouchTypes = #[ #(UITouchTypeIndirect) ];
You'll also need to make sure that either the scroll view itself is the focused view, or is a parent of the focused view, since all touches from the remote will start at the center of the focused view: you need to make sure the scroll view is getting hit-tested for the events to work.
Zooming won't work, because the Siri Remote can only recognize one touch at a time, so you can't do a pinch gesture on it.
Swift 4 version (from here: https://stackoverflow.com/a/41000183/945247)
scrollView.panGestureRecognizer.allowedTouchTypes = [NSNumber(value:UITouchType.indirect.rawValue)]
I have UiTableView containing some data, and I want to scroll the UiTableViewCells horizontally to the left or right to show some UiButtons that act some action relatif to the content of the cell.
How Can I do this?
I'm thinking in creating custom cell, and putting a scrollView in it, May this did the trick?
There is a tutorial for this at http://idevrecipes.com/2011/04/14/how-does-the-twitter-iphone-app-implement-side-swiping-on-a-table/ with sample code. He is using a UISwipeGestureRecognizer to trigger an animation that pushes the cell off the screen.
You could use a swipe gesture recognizer attached to your cell.
You can add a UIScrollView to the contentView of a UITableViewCell. If you want to scroll the content using buttons, simply overlay the UIScrollView with buttons and make them call the various scrolling methods of UIScrollView.
Nested UIScrollView (UITableView inherits from UIScrollView) are quite clever about detecting touch conflicts and resolving the users intended gesture.
https://github.com/JonasGessner/JGScrollableTableViewCell might be what you're looking for. It implements this using a UIScrollView inside the cell (just like the iOS 7 mail app).
(Yes the answer is a bit late, but it's never too late! :P)
I have a Cocoa app in which one of my NSOpenGLViews can go into full screen mode (I do this with the method enterFullScreenMode:withOptions:). I would like to create a little widget that when you mouse over it, a toolbar pops up with some different controls. I am wondering what would be the best way to implement this widget? At first I thought about using a panel but I don't think you can bring up any windows when in full screen mode. Also, it seems that you can't add a subview to an NSOpenGLView? Are these two assumptions correct? What else could I use to accomplish this?
I would add a subview to the openglview's superview.
You can't add any subview to NSOpenGLView.
You can use glViewport to simulate subviews.
I need to develop a chat window kind of view, with the following requirements:
Be able to display an image
have custom control like a progress bar
scrollable, and finally,
copy and paste
I want to know which class should I use. Can I achieved all the above using NSTextView or should I go with a NSView and keep ScrollView inside it (drawing the text and other custom controls manually)
I appreciate your valuable comment
Thanks in advance
Just drag a nstextfield in your window in the interface builder. It will be much easier