Click inside UILabel - ios

I'm working with an iOS application. What I'm trying to accomplish,
Let's say the text for the UILabel is "Rikard bla bla bla Rikard".
So in this text I have tagged two people. And when I click on one of them I display a detailed view about that person. So this is working great if I just have one user named Rikard, and it works with multiple too and I can present the detailed view. But my problem is that I don't know which user I clicked on if I have tagged multiple people with the same name. I know I have to go for the ID. Right now I display by name, so it's not that strange that it's not working.
Should I save information in the database in which order the user entered the two tags or how can I ever know who is who?
Please point me in the right direction. The functionality is working great, it's just the logic for who to display when I click. I want to recreate the tagging system that Facebook have when people comment a photo and tag people in it. You can write multiple names there and Facebook will of course know who is who.
ADDED
So what I do when I'm creating my tags. I choose from a list of available tags or I can write them. I will always know which tag to save the current comment with. But the problem occurs when I display them in to different parts,
The first part is just a UILabel with all the tags in a row, separated by blank space. Here I know where the user tapped and I can display the detailed view for the with the name.
The second part is all of the text, I can find where the tags are located, on which line and between what pixels on that line. And I know when I click on them.
But what I need is the logic for clicking two tags with the same name in the same UILabel. Should I somehow save the order of how I saved the tags?

One option that comes to mind is using an NSAttributedString in the label. You may add arbitrary attributes to ranges of text using that class, and its mutable subclass. Thus, you could add a custom attribute to the range of each user's name, and assign for the corresponding value some unique identifier for the user – possibly an NSNumber or NSString that can be used to retrieve the proper information.

Related

Google Sheets - Validation list to default on selection in another cell, but still provide drop-down options

I'm stuck on this one, and after a number of google searches am now wondering if I'm the only person who's ever tried to do this.
I have a google sheet that users are required to fill in. There is a drop-down selection option at the top, specifying the region the user needs the file for.
However, as the user gets down to the lines for the individual items required, some (a small number) may not be for the region selected at the top.
So what I'm trying to do is add the regions to the individual lines. The default for each line should be the region selected at the top, so this should show as pre-selected. But I want the user to be able to still click on a drop-down arrow and select a different region for a line.
Does anyone have any ideas on how to do this? Thank you!
Okay,
I'm unsure of your expected outcome, your request is also not very clear -
What I've done is created a list via Data validation, however, if a user enters data into the adjacent column:
https://docs.google.com/spreadsheets/d/1OsrQCUt-Urf_Gx8_l9CBZkaUlDc311-S-0csa9GAtCQ/edit?usp=sharing
also it's good practice to share an example of your workbook for others to edit and work on.
let me know if this is what you wanted.

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.

Blackberry list field without canvas

Is it possible to create a customized list field in BB, where each row will have 4 different labels, and a bitmap field, without implementing the drawListRow method?
Since drawListRow uses canvas I want to avoid it. Because, I need to display a browser field in list row. Or is it possible to add label fields in list row?
You probably aren't going to be able to implement this the way you want - try putting more than one BrowserField on a screen at once and you'll soon run into multiple issues. I'd suggest creating a custom Field to act as a row instead, or try and get the desired look n feel using Field Managers.

How can I add selectable suggestion on textfield

I'm not sure if I use the phrase correctly.
The function I want is that after user typed some characters (or clicked a button), a list will be shown under the textfield.
An easy example is Google search. After you typed "fb" or "faceb", it shows "facebook" in the suggestion list.
The content of the list is stored in an array, which comes from the return of web services.
Thanks
You've got to intercept the keystrokes with UITextView textViewDidChange. Then, with each keystroke, you implement the lookup algorithm and display your list of selections above or below the UITextView where the data entry is occurring. The list has to somehow be "touchable" to select from it.
Ray Wenderlich has a tutorial that shows how this can be done over at his blog
He creates a table below the text field that is touchable.
There is also a sample project there.

MonoTouch.Dialog events and Sections

i need one more help.
First question is: I understood that the sections, text, images, etc on a MonoTouch.Dialog will be created dynamically. But can i have buttons as well? If yes, how can i have the events of that button binded.
Second question is : Basically i have a search text, and a button, on the click of the button, the text is sent to the Twitter-url, to get the tweets, these tweets need to be displayed, now they contain, images, texts, and reply and a favourite. Can the search result and the Search Button+Edit box, be the part of one ViewController?
But can i have buttons as well?
Element in the DialogViewController often act like buttons. But if you want a real UIButton you can do something like: Monotouch.Dialog two tables
Can the search result and the Search Button+Edit box, be the part of one ViewController?
I don't see any problem doing that. Use the code from the above link and add a EntryElement.
the text is sent to the Twitter-url, to get the tweets, these tweets need to be displayed
Have you looked at TweetStation ? It's an open source application that is based on MonoTouch.Dialog. It can likely help you answer questions on both fronts.

Resources