I am developing an App with information about a location. This information contains phone number, email address, address etc. A bit like the contact detail information of the iPhone itself.
Now my question. When I select a contact in my phonebook, I can select the phonenumber to call, select an emailaddress to mail and select the location information to view it in the maps of the iPhone. This is what I want to achieve.
I have searched google for this functionallity but I am probably searching for the wrong things.Can someone help me to achieve this functionallity?
Thanks!!!
//// Followup
Now I know that the stuff I want to add is possible, I have a followup question about this subject.
Does anyone know where I can find some examples about the actions for calling, mailing and location information? It would help me a lot...
Thnx!!
With kind regards,
Douwe
Here is the link for accessing address book details.
This example shows to display the first name, last name, instead you display phno.,email, location along with a button near ti it.
Then code in your button action to call, mail, view location respectively.
If you are using a UITableView, then tableView:didSelectRowAtIndexPath: will get sent to you (the table view delegate (usually the table view controller)) each time the user presses a row in your table.
In the Contacts app all phone numbers/emails/addresses for that contact are grouped in their own "section". By reading the section from the indexPath using [indexPath section] you will get the index for the section (a NSInteger).
Using your own app logic you can use that index to determine if the user pressed something in the phone/mail/address section. Now that you know what kind of information the user tapped on you can make the right thing (initiate a phone call/send an email/give directions)
Continuing using the same indexPath you can get the exact table view cell that the user clicked on by using [indexPath row]. Now you can send that information (say a phone number) to you own code to handle that information (initiate a phone call).
(Hope it helped, it was my first answer on StackOverflow)
Related
In my app I have the need to allow the user to assemble a "To list" of emails. The built in mail composer has exactly what I want as far as being able to select contacts. It has a drop list that displays potential matched contacts from what you are typing. However this is not for sending an email, therefor I dont' want the CC, Subject, and Body controls.
Is just the "To" field available in a control somehow? I don't see really how to do this without writing quite a bit of code.
I suppose I could always bring up a mail composer and then another view to cover up the rest of the form, but I'd rather leverage just the To field.
Is this possible?
Maybe this will help someone else. After much searching I didn't see any way to leverage the To: field only. I ended up coding my own set of view controllers to copy the actions and behavior. I made the following classes:
Contact (string properties for first name, last name, and email)
Contacts (class methods to create an NSArray of Contact objects in various formats)
ContactFormViewController (analog to the mail composer's To: field)
ContactTableViewController (displays a list of all contacts with a scrubber)
Inside Contacts class, I used ABAddressBookRequestAccessWithCompletion to create an NSArray of Contact* objects, sorting the array as I construct it.
I then have two view controllers, just like the mail composer.
On the first view controller, there is a UITextField to type an email address or name into, a UITableView to display contacts that match the input string, and a UIScrollView which I add UIButtons to each time a contact is selected in the table. Each editingChanged event on the UITextView creates/updates the datasource to the UITableView. There are also two more UIButtons. One to add a manually typed email address to the list selected contacts (this button is only visible if the text input matches an emiail regex), and the other button is to show the UITableViewController if the user would rather browser to contacts than type them in and pick results.
I have been told to do the following:
Implement contact add view like below and let him store in SQL table,
contacts will have Name, phone no of mobile, work , fax, email . view
should look like below:
My question:
Can you clarify me, should I use Addressbook or simply a custom view and a sql database to save data from that custom view? I mean both the options are open here?
You can not use address book to create custom content in your application.
So you should implement your custom view to collect information to store in your database (sqlite?)
If you are creating contact / modifying existing contact information, you can use address book framework.
Answer for the question in comment (how to go about for this kinda UI)
Yes, Have the grouped table view to get the desired background
Among the many possible solutions, here is the simplest one perhaps:
Have 2 sections in your table.
First section has a special kinda cell. Only one row in this section.
You can use Interface Builder to create the cell contents or you could build from code.
Second section contains similar cells. It can contain as many as the fields you need.
Just specify UITableViewCell's style to be UITableViewCellStyleValue2 and specify the values accordingly
I have created one Login Screen where user enter their mail id.
But i want to insert one functionality where it should list the mail id automatically when user type first character of mail id
There is one way. I don't know how much feasible it is. So the Idea is : You can store somewhere all the email id after log in success. For example in sqlite database. Now, Implement Notification center for "UITextFieldTextDidChangeNotification" and search for the character in database when user start typing in TextField and show UITableview underneath UITextField with match results (which start from entered character).
When user tap on any cell of Tablview hide tableview and take that cell label value in UITextField. That's it. Hope this logic work.
You can save the emaid id in UserDefaults & use it whereever you want
Is it possible to use ABPersonViewController or ABUknownPersonViewController to display contact information within my app.
ie.) you click a button that says "contact info" -> which then loads a ABPersonViewController with static information such as address and phone number etc and would be pushed onto the NavigationController?
The reason i want to use this is the nice functionality which is built in already. -buttons that have address and phone numbers in them that are nicely formatted and when clicked perform phone calls or open the map.
Sure, you can use these. Set ABUnknownPersonViewController.allowsAddingToAddressbook to NO to prevent the user from adding the info to an existing or new contact.
Settings for Mail allows one to add items to a list (the list of accounts) by choosing the "Add Account..." entry at the bottom of the list; info gets entered on a separate screen, and now the list has a new entry.
Is there a way for someone other than Apple to accomplish this & still get into the App store?
Is there a way for someone other than Apple to accomplish this & still get into the App store?
No. There is no public API to do something like that.
If you're asking can someone modify the add new account list under mail settings programmatically, the answer is no. Even if there was a private API I doubt it would get through the apple review.
Yes, it is possible to create a similar UI-functionality in your app as the one described.
Simply add a list element in the end of your TableView to act as a list footer with desired functionality.
Once clicked, swap to a another view. In this view you change the data source of your TableView so it contains a new element. Once you go back to the TableView, the new element can be drawn into the list.