MonoTouch.Dialog events and Sections - ios

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.

Related

Click inside UILabel

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.

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.

How to show multiple actions on a list item in iOS

I am coming from android and trying to replicate my small app to iOS. I basically have a list of things and certain actions can be taken on each thing. For example:
Colors
---------
Red <fav> <delete> <edit>
Green <fav> <delete> <edit>
...
Black <fav> <delete> <edit>
Though I have not seen many apps on iOS do this. Is this doable? Or should I have an "Edit" button on top right hand which then shows these actions?
For what you describe, namely a list of editable items, the Master-Detail-Application template seems to be a good fit. Editing these items is usually done by tapping the respective item, which then brings up the detail view. A swipe gesture usually allows to delete items from a list.
Also you can have a look at the Mail app and see how it handles the e-mail list (aka items) and one email with its text, etc (aka detail view). I would suggest a similar behavior for your app.
Use UITableView to show the list of items.
Refer this link to know about UITableView : https://developer.apple.com/library/ios/documentation/uikit/reference/UITableView_Class/Reference/Reference.html
In UITableView, You can create the custom cell and add your buttons (fav,delete,edit) on it.
Please refer this link as well : http://www.appcoda.com/customize-table-view-cells-for-uitableview/
Thanks!

IOS: UITableView with search: displayController not selectable?

I'm a newbie trying to create a simple sample app that takes json data from a website and list it on a UITableView.
Each voice in the UITableView is clickable to show more details.
I started from this example/app because it was clean and working:
http://nscookbook.com/2013/12/ios-programming-recipe-16-2-populating-a-uitableview-with-data-from-the-web-ios-7-and-afnetworking-2-0/
What I was missing was a searching function, so following this other page and adapting code I got it working:
http://www.appcoda.com/search-bar-tutorial-ios7/
The only problem I have is that when I search for something I get correct results filtered, but the list of results it's not clickable (to go to the details view/page) and it does not contain the small 'Rating' subtext.
Basically the filtered list only gets the 'Name' and nothing else of the original array, and the cells are not clickable.
What am I missing?
I solved eventually the issue using a SearchBar without its own display view, so basically refreshing the main tableview (already configured to show all details) if/when something is searched.
The search simply filter the main array and in all functions to display the result I show either the main array or the filtered one.
Thanks!

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.

Resources