How do i change color of letters of sectionIndexTitlesForTableView? - iphone

Hope you all are fine and also in best of your moods.
I have a little problem kindly help me to get its solution.
my Problem is:
I am using vertical search in my application, using method sectionIndexTitlesForTableView() of tableview i get all Character listed from top to bottom at rightside.
But this letters have fixed color. i need to change this color. Since i newbie i don't know how to deal with it.
Please help to get solution.
Thanks, and sorry if you found me with wrong english.

There is no supported way to do this. Even if you had access to the index view (which you don't easily), it would not be possible because there is no NSAttributedString on iPhone, so you couldn't return color information.
The best way to achieve this is to turn off the tableview's index and generate your own from scratch, floating it over top of the tableview. But I would not recommend this approach for a new iPhone developer. It is best to spend some serious time learning to build UIs the way Apple intends you to. Once you understand Apple's UI and how it's implemented, then you can make informed decisions about whether you should break the UI rules.

Related

How to create tabs dynamically in Objective C

I am trying to implement the following kind of tabs into my Application. I have first tried it with creating buttons. So can anyone guide me how to create this kind of interface ?
I want to clarify that this are the groups & it will be dynamically created & it can be in any number.
Any suggestions & references will be highly appreciated.
Thanks in advance.
I've been implementing pretty much exactly what you are asking in an app im working on, i've uploaded the source files here. its pretty much plug-and-play, just make a TabView where you want your tabs and hook up the delegate methods. can swap out all the images with your own (my tabs were underneath something and not on top so they will look upside down initially for you).
Dont really have time to explain the inner workings of it all, but if you play around with the code im sure you will manage to customise it how you want. otherwise, just learn from it and implement your own.
edit: oh and there is some code that changes how the tabs look depending if iOS 7 or not, you will get an error when first importing it because i have a variable in my appDelegate isIOS7 which you can either implement in your app, or just take out all the relevant iOS 7 checks in the code

Nice looking UIButton

I'm trying to make a nice looking UIButton. I'm not exactly sure what I mean by that, but something nicer than just a plain white looking rounded corner button with blue font. I can't seem to find anything online, so can anyone help? I want to do it all by programming (no XIB) and I am not an artist so I can't draw any custom images or anything like that.
Back in May of last year, Jeff LaMarche (of iPhone dev shop Martian Craft and co-author of several iPhone development books) put out a suite called GradientButtons that makes it easy to implement pretty, shiny, colorful buttons. I've used it in several projects and it's quite nice.
Here is a tutorial on how to make a shhiny button all in code, no image needed!
Tutorial on gradients at CocoaWithLove
http://tapadoo.com/2010/tired-of-trying-to-create-nice-buttons-for-your-iphone-app-try-this/
I ran into the above link when I was searching for a similar resource. Did the job
The Apple UI guidelines would suggest I think that you use the standard button unless you have good reason not to.

Text Editor like Pages iPad App

I want to implement a functionality similar to found in Pages app..i.e. text floating around images, image zooming etc.. I have been struggling with this part of my application but no success yet. Would be grateful if someone provides me with some pointers in this regard , like 'Which UIControl should I use?','Help in thinking logic' etc..
Thanx in advance.
Sounds like a fun app to develop.
Some Pointers:
Immediately off the bat, I would say look into creating your own Controls for the floating objects.
I would suggest tackling a smaller project, or maybe a few small to medium size projects. p
Try making a few apps with WinForms or WPF. Also look into XSL:FO.
Immediately off the bat, I would say look into creating your own Controls.
There was a WWDC session that talked about iOS text. I don't think it's violating NDA to say this is going to be a very hard project. No, make that very, very, very hard.
You will probably need to do all UI yourself, and use Core Text for rendering of the text. (But I believe you need to draw selection, etc.) And do the layout yourself.

What's the best way to skin my iPhone app (similar to how the Notes app is skinned)?

If you look at the Notes app on the iPad, you can see it uses all native iPhone controls, but they're "skinned" to look like a pad of paper. What's the best way to implement something similar to that? Could I use interface builder and simply change the background image for each of the controls, including the TableViews?
Thanks in advance for all your help! I'm going to continue researching this question right now.
This article from Dr Touch will probably come in handy: Stuff you learn from reverse engineering Notes.app
It's a little more complicated than that. My suggestion is manifold:
Hire a real designer to make the artwork.
Subclass whatever controls you want to skin, and handle this business directly in drawRect:. Interface Builder will not help you in this instance.
Consider drawing your controls programmatically instead of using images; a really cool thing would be to cache the programmatic drawings so that they only have to be performed once.
Best of luck!

Implementing Autocompletion in iPhone UITextField for contacts in address book

I would like to have a UITextField or UITextView in where as I do some input, alternatives will appear something similar to when you type an address in Mail Application, alternatives appear down and is possible tap them so get a better input user interface.(since there is no need to type the complete word or address or phone number)
I do know how to fetch data from Address Book framework, also how to input text in UITextField/UITextView and its delegates but I don't know what kind of structure to use for fetching and showing data as the user do his/her input.
I know basic CoreData if this matters,
I hope I can get some help.
UPDATE (2010/3/10):
I don't have problem make a native-like GUI but I am asking about the algorithm, does any body knows what kind algorithm is best for this thing? maybe some binary tree?
Or should I just fetch data from coredata everytime?
Thanks
Ignacio
UPDATE (2010/03/28):
I've been very busy these days, so I have not tried UISearchResults but it seems fine to me. BUT I wonder was there a necessity of deletion of the wining answer? I don't think is fair my reputation went down and couldn't see the winning answer. ;(
You don't need some advanced algorithm to do this kind of thing... if you want to search the address book, then you can do so each time the user types in a character (or however frequent you need to seach). To do this, just take a look at the UISearchDisplayController class. I learned how to do almost the exact thing by looking at Apple's TableSearch sample app.
That app searches a list of objects using different fields (All, Device, Desktop, Portable)... so you could adapt it to Address Book fields (First Name, Last Name, Address...). The only thing you need to change is the search within the Address Book. I don't know exactly what your requirements ask for but this should be what you need to get it done. If you have any trouble with the code let me know... but this example really helped me, so hopefully it works for you.
I was looking for the same thing a while ago. Something that people kept suggesting was the Three20 project (google it).
For my needs this was overkill because it requires the whole project to build and I didn't want the whole project. Plus it's more fun to try it yourself :)
I ended up starting from scratch and making my own:
I started out with a subclass of a UIScrollView to contain the different controls. I subclassed a UITextField and overrided "editingRectForBounds" to support multiple lines. The bit where the contacts are displayed is just a UITableView with a background color of:
[UIColor colorWithRed:0.92 green:0.92 blue:0.92 alpha:1];
And separator color:
[UIColor colorWithWhite:0.85 alpha:1];
This and the use of a shadow makes it looks like it's sunken slightly under the UITextField. I create the shadow with a custom UIView, loading it once and hiding it when required, but it works just as well with an image.
Finally, I made the blue pill shapes with a custom UIView which can intercept "touchesBegan" to know when they should change color.
Adding them is a simple matter of calculating where they need to go and using:
[myTextField addSubview:myBlueView];
Hope that helps!