How do I create a dictionary-style scroll bar for iPhone (like in the Contacts list)? - iphone

I am creating an iPhone app which I would like to have a similar interface to the iPhone's native contact picker view, i.e. an alphabetical list which you can scroll through, with a search bar up top which narrows down the list. Particularly, I'd like to be able to show the letters of the alphabet down the side so that as you scroll through the list, you see your position in the alphabet in the scrollbar. The problem is that my data basically consists of key-value pairs, not contact data, so I can't easily use the native contact picker.
As far as I can see, I have two options to achieve what I want:
Use the ABPeoplePickerNavigationController class and hack it to use an address book which I fill myself with non-address type data. The problem with this is that, by default, the address book will fill up with the contacts from the iPhone so that each time the app opened, I'd have to flush those contacts and build my own list. (Not to mention other problems associated with using an interface which is bound to a particular data structure)
Use a UISearchBar and UIScrollView. This would be fine, but I'm not sure how to do anything to the scroll bar except change its colour - I can't see how to override its contents.
Any advice on which is the simplest way? What are the pitfalls (particularly of 1)?

To get the letters down the side, you can just provide a -sectionIndexTitlesForTableView: method in your table view datasource. As for searching, there's a bit more work there, and it's very dependent on your data. A UISearchBar is the place to start, however.

For a search bar, have a look at TTSearchBar in the Three20 library.
Everything else can be easily implemented using UITableView.

Related

Alternatives for picker in iphone/iOS app?

I am showing a form the user fills in my iPhone app. One of the fields is a set of 2 or 3 dates from which the user has to pick one. Putting a picker, or bringing up a table view just for this takes up too much space, leaving no room for the other fields. Is there any simpler way to do this?
To do this you can put two or three arrowed label with text like "Select Date" upon click of it you can show one view that allow user to select the date; once selected you can back to the original view. You can do this for all three (or two) dates and get those date on form view.
I am giving you idea of how you can design apps; if you want code i can assist that too but from your question it seems you want design ideas.
You can go for your custom drop down/combo box, but their is no inbuilt functionality present for this.
Also following is mentioned in apple HIG guideline, you need to consider those as well-
(http://developer.apple.com/library/IOs/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html)
Guidelines
Use a picker to make it easy for people to choose from a set of values. It’s often best to use a picker when people are familiar with the entire set of values. This is because many, if not most, of the values are hidden when the wheel is stationary. If you need to provide a large set of choices that aren’t well known to your users, a picker might not be the appropriate control.
Consider using a table view, instead of a picker, if you need to display a very large number of values. This is because the greater height of a table view makes scrolling faster.
Use the translucent selection bar to display contextual information, such as a unit of measurement. Do not display such labels above the picker or on the wheel itself.
On iPad, present a picker only within a popover. A picker is not suitable for the main screen.

iOS 4 - How to add table view to a tab bar application

I am new to iPhone programming and am having a really hard time trying to figure out how to add a table view to a tab bar application. There are not many tutorials on this for iOS SDK 4 and the Apple documentation is very light on details. Since I am new I would really like some tutorial that has screenshots (or at least clear instructions) when it comes to things being done in Interface Builder (like making connections between the objects and File Owner, etc), usually lot of tutorials/blogs gloss out these details.
What I am trying to do is create a tab bar based application with 3 tabs (this I am able to do). The first tab needs to display a table view with the header having 2 buttons (one on right and other on left, with the title in middle).The title is actually today's date, obtained from the phone. Clicking either of the header buttons should take you to another table and the title should be yesterday's date (if left button is clicked) and tomorrow's date if right button is clicked.
Can some one please suggest me a good tutorial for this. I am thoroughly confused by the Interface Builder (especially how to create connections).
The only page I remember frequenting on the past, is CocoaDevCentral.
Personally, I learnt how to use Xcode through video tutorials, so I recommend you to start searching there. Also, to help you with your search, always look for the full name of the objects involved, for example: instead of searching for "tableView", look for "UITableView", apple's notation is very particular and helps narrowing down the result.
Finally, ignore the nay-sayers about Interface Builder, you should give it a try, and see if it fits your style. For instance, I like being able to get a look at the overall design, as I usually help with the design.

iPhone - is this screen available and customisable or do I need to create it from scratch?

I have noticed that in some apps they use what appears to be the the native display screen for a contact, it shows the contact photo, name, phone numbers and options to text message and add to favourites.
But it also will have some customized fields in it also like missed calls or some other non native contact information,
Here is an example screen shot taken from the Viber application:
I am quite new to iPhone development and I was wondering if this screen is made available to developers so that a contacts information can be presented from within an application with custom fields or if it is not and has to be developed from scratch?
EDIT:
Thanks for the help, with it I have successfully recreated the screen in a static manner, I have one more question and that is how would I make the cell that has the outgoing calls in it react to dymanic data?
So for instance there could be 10 calls there, so how do I adjust the size of the cell on the fly? And also whats the best object to use to allow the calls to be displayed? At the moment I'm using a UITextView to display the static data but I dont think this will work for dynamic data?
I think the developer made this screen there self, it just an UITableView with some custom UITableViewcells.
You can use the UITableView haderView property to insert the the top view with the image.
The just add sections for all the white cells, make use the the tableview style is set to grouped.
The screenshot is probably showing a custom UI that is made to look similar to the standard one.
You can get a similar interface with some limited customization options with the ABPersonViewController class (in the AddressBookUI framework). It basically takes an address book entry (ABPerson, you can also create this from scratch) and allows you to specify which properties (phone numbers, email addresses...) to show.
You can also customize what happens when you tap on a property by implementing the personViewController:shouldPerformDefaultActionForPerson:property:identifier: method in the view controller's delegate.
The above screen can be created by using UITableView. Since u're new to iPhone..I would suggest you to first go through some basics.
For UITableView, Here's the Link..
UITableView Class Reference
Also look for UITableView Cell Formatting in google.
Hope dat helps... :)
happy coding

Creating an alternative way to scroll TableView on iPhone

I currently have a TableView with over 35,000 cells. Obviously the standard iPhone flick-and-scroll becomes inefficient with this many cells. I have already implemented search but still think that a way to scroll the entire table is necessary. I am currently using the
-sectionIndexTitlesForTableView:
method to populate the side with the relevant characters, and I want similar functionality to that in Apple's Remote app. I do not have section titles in my table and simply want the sectionIndex to be an alternative way to scroll through the entire 35,000 cell table. How should I go about doing this?
My instinct tells me that a list that large could probably be broken down into smaller sections that could be filtered using the standard hierarchical navigation on the iPhone - that said, without knowing what exactly the data is I can't say that with any confidence.
You say you don't have any section titles - is the list alphanumeric? If so, what is wrong with having a standard alphabetical sectionIndex and sectionTitles?

What's the best layout for a scrollable iPhone "detail view" with variable content?

I'm building a navigation controller based iPhone application and am curious how to go about building the detail view for my application. The part that's complicating my endeavor is: What UI elements/hierarchy should I employ to create a variable-height yet scrollable detail view?
A great example of my goal is an arrangement like the mobile App Store detail view. The horizontal divisions between the heading, description, screenshot, etc leads me to believe it's a table view in disguise, but that's just a guess.
Currently, I'm using a UIScrollView for my detail view, but since I can never be sure of the exact length of my incoming content, my description view ends up with either unused space or truncated text. Is there some set of elements that would be best suited for displaying this variable-height content in "blocky" format (like the example) while still maintaining overall view scroll-ability?
Thanks in advance for your assistance!
If you want to be able to easily format complex content you can use a UIWebView. What I basically do is create an HTML template and add it as a resource. At run time I load the content of this HTML doc and do string replacement to add the content I want. Within the HTML I place placeholders like
<div><!-- ARTICLE_TITLE --></div>
I don't think the App Store detail view is a UITableView. In fact, I'm pretty sure it's a subclass of UIScrollView.
To determine the size of your content, you can use NSString's sizeWithFont method.
A little late, but still relevant: The App Store broke a few weeks ago, and the "Featured" tab of the App Store was very obviously HTML without CSS applied. So, it's actually a UIWebView, or web content displayed in some fashion.
The touch-down behaviors of the iTunes app, while appearing quite similar, behave differently, in a more native fashion. I'm not convinced this app is implemented in the same way.