Drag and drop a highlighted text within an iphone TextView - iphone

I'm trying to highlight a word then drag and drop it anywhere within the iphone UITextView. Can anyone help? Thank you much!

Ok, you're going to run into two problems.
problem 1) you need to add a gesture for a drag and drop. Defining a new gesture that will select the a word and drag it should be too hard.
http://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizers/GestureRecognizers.html#//apple_ref/doc/uid/TP40009541-CH6-SW13
this portion of the article should lead you in the right direction.
problem 2) You can't just add the gesture to the UITextView when you load. When you select a UITextView it will become the first responder by default. When the keyboard is loaded the UITextView class will add Gestures to the TextView to handle the standard text edit gestures. After this the UITextViewTextDidBeginEditingNotification will get sent
you should then add your gesture to the textview at this point. Otherwise it will get over written.
I hope this leads you in the right direction. Good luck.

Related

Displaying a popover on a text tap

I'm working to try and create a kind of wiki-esque app, in that when you click on a piece of text displayed in a UITextView, the app displays a popover with the word's definition. I've been searching around and the best idea I have is just tracking the location on the screen of all of the text that can have a popover and then tracking where exactly finger taps occur and displaying a popover when they coincide. Are there any better solutions to this?
Thanks,
Pete
The easiest way that I've figured out to do this is to go line by line and essentially paste a UIButton with the same text as the link over the original text. This means that I had to use UILabels for every line and then add them to an entire view. You get the same effect as a UITextView, but you can pinpoint the CGPoint where the text appears in a line.
Kind of hacky, but it was the best solution I could find!

UIView container to autoscroll on keyboard resize

I have a UIViewController, it's a view (UIView) containing two elements - UIPageControl and also a UIScrollView. Now, when using normal keyboard, the view is a perfect fit, sharing the screen with the keyboard. But when an international keyword is used, the keyboard would add an extra ribbon for showing the international characters. When that's happened, the view would be covered by the extra keyboard ribbon. The view can't be resized as the UIScrollView view contains a table of two rows of fixed size. So now I am wondering if I should find a way to allow the UIView container to up shift to accommodate the ribbon and shift back when the ribbon disappears. Or is there any other better solutions to work around the issue?
Check out my answer to this stackoverflow post here: detect the appear and disappear of international keyboard
Basically, you'll want to sign up to receive notifications about when the keyboard is shown. From there you can get the keyboard frame size and then adjust views in your window to display properly. The tutorials in the post really do a good job explaining how to do this. Check them out! If you still have questions I can try to help you with specifics.

Problem with UIScrollView and keyboard in iPhone

Let's see: i have to views each with a couple of textfields.
One was built regularly, the other one has more textfieds and components so i added a scroll, which works (sorta). The problem is that, now, when i touch one of the text fields the keyboard appears and it hides the components, it doesn't scroll "naturaly" like in the regular view with no scroll (there, you know, the keyboard appears and the view "moves" in order to show the active text field).
So how can i accomplish that from my scroll?
I hope i've been clear, i'm an iOS newbie.
Your answer should be found here.
How to make a UITextField move up when keyboard is present?

Focus and zoom in on a UITextField when touched?

How in the world does one get the iPhone view to zoom in on a focused UITextField? I need to tap on a text field that I want to edit, and my view should zoom in to the tapped text field and pull up the keyboard (which it already does), similar to how many Internet text fields gain focus on the iPhone. Is this some type of overlay?
I've been looking everywhere for this solution but maybe I've just got the wrong terminology. Thank you in advance.
Could be a duplicate of this StackOverflow question.
In essence, there are a number of ways, but you have to program this effect manually. A textfield is already an overlay. You can either move it, or scroll the containing view.
Please follow the following steps.
Implement the delegate method for all textfield.connect the outlet of textfield in interface builder basically it's setting the delegate property.then in delegate property you can defined the method whatever you want to implement or wanted to do functionality.
Thanks

Swipe to change UIViewContent

Hej folks,
I got an UIView in my application and want to implement kind of a swipe gesture. I know how I detect this gesture (touchesBegan: and touchesEnded: for example is x coordinates are distanced more than 100 pixels or something else) but I really donĀ“t now how to animate my needs. In fact my UIView will contain subviews which are 9 UIButtons. On swipe I want to change the set of buttons programatically...any solutions out there? Primarily need the animation!
EDIT: I thought about programatically moving the buttons off-screen to the left and at the same time move the new ones on-screen from the right side. But it seems I don't really know how to realize this...isn't it too much leaking at the same time? Please give me a hint!
It's seem that you want to recreate somethings like the springboard but with button instead of icon.
I can suggest you to use UIScrollView.
why you don't load just a new view with the other button set in your window after the swipe gesture was detected?