Is there an extension that will define or briefly explain any particular method, attribute, or tag on hover or right click? - editor

Is there an extension that will define or briefly explain any particular method, attribute, or tag on hover or right click?
when typing code such as
nameLog = nameLog.toLowerCase();
.toLowerCase() being the method
is there any editor or extension that would allow me to right click on the method and quickly describe what it is?
another example: If I wanted to know what this tag was used for I could click or right click for a description.
Basically I want to be able to learn about the code I am typing as I am typing it or right after I copy it into my document or type it.

Related

VoiceOver : is 'accessibilityActivationPoint' really useful?

I tried and understood what could be the purpose of the accessibilityActivationPoint but in vain.
When a focused accessible element is activated, that property should indicate VoiceOver the specific area it's going to activate when a user double-taps the element (Apple reference) : for me, it's always the selected element itself.
I understood the selected element is considered as a block by VoiceOver, whatever the other elements inside. Once a double tap occurs to activate this block, VoiceOver calls accessibilityActivate to know what to perform (Apple reference).
1/. I've written many tests by creating a custom view including a switch control. Whatever the value of accessibilityActivationPoint inside (or outside on another switch control), the value of the switch control never changes. Is it a proper use case or am I totally wrong ?
2/. When we gather many elements inside one accessible element, how is VoiceOver able to activate one of them while they aren't accessible by definition ? Pointing one of them thanks to the accessibilityActivationPoint should work ?
Personally, I couldn't make it work and think that I'm really confusing accessibilityActivationPoint and accessibilityActivate.
Any help would be appreciated, thanks in advance.
Yes, you have the right idea with accessibilityActivate and accessibilityActivationPoint. Note that, in order for it to work, the accessibilityActivationPoint needs to be a point within the Control that you are trying to activate in on-screen coordinates (use the convert function!).
I think the short answer is "yes" to answer your second question, but, just to clear up confusion about when Accessibility Activation Point is useful, I'll go into more detail about it.
By default (aka, the default behavior for AcessibilityActivate()), when any view is activated by VoiceOver, VoiceOver will send a "tap gesture" to the center of the view. The position of this "tap gesture" can be changed by updating the accessibilityActivationPoint attribute on a view. Below, I have an example for how this property can be used.
Let's say you have a blank button (in the image below, the button is the gray box) next to some text:
For the purpose of accessibility, you may want to make the entire view that holds the button and text an Accessibility Element (so that VoiceOver users can easily understand that the button is associated with the text "Worldspace Attest"). In the image below, I am using Accessibility Inspector to show that the view holding both of these elements is an Accessibility Element.
Notice in these images that the button is not in the center of the view, but rather, it is to the right. When you activate this view using VoiceOver, the view will not select the button; instead, it will send a "tap" to the center of the view (which is the same as tapping the text, which does not do anything). In order to select the button, you have to set the view's accessibilityActivationPoint to be the on-screen coordinates of the button:
view.accessibilityActivationPoint = self.convert(button.center, to: UIApplication.shared.windows.first)
This should make it so that this button is usable by a VoiceOver user.
I hope this information clears up any confusion about the Accessibility Activation Point property. The example I used above can be found in this repository in the "Active Control Name" demo.

Use link words in a text in UITextView [Objective-C, Xcode]

I`m starting in Objective-c this Year and I found nothing that could help me in the logic of how elaborate it:
Look!
I have a UITableView with a list of drugs. When I click on any medication, I'm taken to a DetailViewController that displays the text information about this drug. In this text, I want every time a drug name appear, it appears as if it were a “link”. So when the user clicks, it will be taken to other remedy detailviewcontroller without need to go back to the list of remedies! What is the better way to implement this?
I thought about passing an array with all drugs for DetailTableView controller via Segue, and then conduct a search for any of the remedies present in the text, but i don't know how to turn that word into a link, or set a function to become part of the text (the drug name) clickable
Just to make it clear, let's assume that we are reading the details of the text on the drug called Amoxicillin:
“Amoxicillin drug works better than erythromycin”
What I want is that the name Erythromycin become some kind of link, so when the user clicks on it, is brought to the screen details about erythromycin. Do you guys understand what i mean?
P.S.: I saw that the UITextView has an option called "Links" in attribute inspector, but i have no idea how to use it or if this is for what i want
Thank you all again!!
Use UITextView And select these attribute.

Add a Text Link to a TextView

Is it possible to add a text link into a TextView? I want the link to perhaps behave like a button, where I can assign an action to it.
EDIT: When I say assign an action, I mean actually giving it something in the code. I'm wondering if it's possible to dynamically add a "button" into text that I can assign a coded action to.
Live scenario
Think of something like a dictionary app. Maybe the definition of one word uses another word that you might not know the definition of, so being able to click on that word to instantly search it rather than having to type it in would be a nice user friendly feature. It seems rather unlikely, though, I guess.
I would recommend using NIAttributedLabel from Nimbus, an open source iOS library. You can specify text ranges that are links, and you get delegate messages sent when a user taps on it.
Main Nimbus site: http://nimbuskit.info/
NIAttributedLabel docs: http://docs.nimbuskit.info/interface_n_i_attributed_label.html
in the inspector, go to the Text View Attributes tab then make sure "Detect Links" is checked.
Yes you can. Add the URL into the text view, then open up the Attributes Inspector. You will see an option in there to detect links.
I know of a way, but its a LOT of work. First, you have an NSAttributedString that you have the text view display. Second, attribute the range of text you want to be the button. Third, assign a tap gesture recognizer to the text view and in the method called by the recognizer, you'll use core text to determine if the tap happened over the range of text that represents the buttons.
Heres how youll use core text: create a framesetter with the attributed string. Create a frame from the framsetter with the shape of a square that is the frame of the text view, inset by the padding of the text view. The frame will allow you to get the y origins of every line in the text view and and once you know what line the tap happened on, you can use the line to then figure out exactly what character was tapped on that line by giving it an x offset. Once you know character index on the line, you can add it to the beginning of the range of the line and get the index of the character within the whole string. Then you can check if its within the range of the text that is your button. If it is, you can then call a method to simulate a target action type behavior.
Ive explained the process of how to accomplish this and specified what kinds of core text objects youll need, ill let you look up the specific api details:
https://developer.apple.com/library/mac/documentation/Carbon/Reference/CoreText_Framework_Ref/_index.html#//apple_ref/doc/uid/TP40005304
You can also use my objc core text wrapper:
https://github.com/mysterioustrousers/MYSCoreText
What about CoreText? It Can draw many kinds of Text .

Making a table row a link with specific CSS class

I'm currently using a script for a popup window, where when you hit the link, a nice graphic popup window will appear. My problem is, that in it's current form it's a text link, which are working fine. But I want the entire row, that being the row the link is in, to be pushable, and open the popup window, instead of just the link.
Some will say I should use an onlick command of some sort, but my problem is, that my current link is defined as:
Link
And I have no idea how to add the rel and class to an onclick command for the row fx.
So is there some smart way to do this?
you can use this trick to make a whole cell a link
simply, add the text you want to link it in a <div> and set both width and height 100%
HTML:
<td><div>link</div></td>
CSS:
td>a>div {width:100%; height:100%}
you can see an example at JSfiddle (the second row):
http://jsfiddle.net/w8W4L/

Customize 'Copy' text popup (UIWebView)?

I'm trying to customize the user text selection behavior in a
UIWebView. Currently, when a user highlights a region of text in a
UIWebView the 'Copy' action sheet appears, allowing you to copy the
text. I would like to perform some custom action on text selection,
effectively replacing the 'Copy' dialog, or adding another option to
the list of options (e.g. 'Copy' | 'Search').
My question is: Is there any Apple-accepted way of doing this? I'd
prefer not to put my app approval in jeopardy, so doing this by the
book is ideal. I've seen similar questions asked about this topic, but
all remain unanswered. Can anyone provide some insight on how to
accomplish this?
The popup you refer to is called a UIMenuController. You can access the [UIMenuController sharedMenuController] method to get the menu controller. You can then add your own UIMenuItems to the menu controller, and these can be shown contextually, using the canPerformAction:withSender: method on the UIWebView. For more info, refer to the iOS Developer Reference on UIMenuController

Resources