How to set UIButton type? - iphone

A small - little question.
I have seen many application having buttons like following.
While using Interface builder I didn't Found any option to have this kind of button.
How to have this kind of button in your application.

See UICatalog example -> Buttons. You will find there this kind of buttons. Usually they're done using png images for pressed & normal states. I think you can do it in IB by binding a png image to pressed & normal states, but the example in UICatalog is pretty clear and can be used "as is"

Almost invariably these styles are done using bitmap images or for the more thrifty of memory, CAGradientLayer.
To do it with CAGradientLayer, you would do something very much like the way the gradient and shadows are done in this blog entry.

Related

Why did Apple not include radio buttons in Interface Builder?

I realized that people have been implementing their own UIButton derivates to create radio buttons on iPhone, as this blog post shows.
This question's accepted answer states you can use Picker Views or Grouped Table views with a check mark, but it seems like a poor man's solution to me. Hence, my question: what is Apple's likely reasoning?
Are radio buttons a bad UI solution for touch interfaces?
Is it so rarely used that it's not worth cluttering IB with?
Another reason I don't quite see, maybe? I believe it's important to find this out, because if Apple thinks radio buttons suck, I'd rather not use them, and rethink my interface whenever I "believe" I should use one...
Radio buttons are a bad UI solution if they are poorly implemented. i.e. too small to reliably work with touches - which is why it's usually better to either use a toolbar or segmented control of options or a tableview of options.
Actually seeing it with a different angle, Apple has neither provided Radio buttons or even Check Box and maybe not because they think that it is a bad UI solution. But instead they've empowered the UIButton control very much that we can configure it as a Radio button or a check box or a switch or anything else with few lines of code.
A UIButton object can be configured and designed in various ways. We've seen various apps using the UIButton very creatively. I personally like the versatility of UIButton rather than Apple directly providing the radio button and Check box to drag and drop it in the interface.

iPhone SDK - Expanding Buttons like in the camera app

I am curious as to whether or not there is an open source solution to replicate the flash button in the iOS camera applicaiton.
I have seem many other apps use this, but there doesn't seem to be a native way, so I assume there is a common source out there.
It is possible to get the flash button by using UIImagePickerController class, but most of the camera apps out there don't seem to be using this (or perhaps they subclass it, which is against apple's terms).
I am looking for a way to replicate the expanding behavior of the button. Any thoughts?
It doesn't sound too hard.
The way I'd do it is to separate the right curve of the button (as images), and make a UIView that has the left part of the button and the right curve as subviews.
When it's tapped, slide the right curve and animate the extra buttons in.
You could use a stretchable UIImage (see UIImage documentation) and then just animate the frame changing.
In the Apple 2010 WWDC Sample code (downloadable via iTunes, otherwise I'd post it here), there are several sample applications which use this control. They call the class ExpandyButton. I realize I'm answering my question, but hopefully someone out there can find this useful.
While looking for a similar solution to this problem I came across this code which was extremely helpful. Similar to ExpandyButton it fit my needs better.
https://github.com/ddebin/DDExpandableButton

iPhone - Proper UI controls for calculations

I am pretty new to iPhone development and currently working on an application which includes a view that performs a simple numerical calculation. In particular, the user enters 3 or 4 values into text fields and the view displays the result. Something along the lines of http://www.moneychimp.com/calculator/compound_interest_calculator.htm
What is the nicest way to achieve this? I am currently using simple UITextFields and a UILabel for the result but it doesn't look nice or "native-like". What UI object would be best to use?
Thank you!
It's entirely up to you. You're using the right classes for actual input- it comes down to how you choose to style those classes. I'd suggest looking at the documentation for UIView and CALayer (youView.layer, and include QuartzCore framework in your project).
A good start might be to choose a color scheme, a background for your app, and the look and feel you're shooting for- this will inform your styling. Try looking for apps that you think are elegant and attractive, and boil down what they do and what you like about them.
I'd say;
use a grouped table style (with the white tables with round corners on a blueish striped background)
embed settings values directly in the cell (aligned to the right) as much as possible
you can show a relevant keyboard (text, numbers) or picker view to let the user pick values, directly when they tap the cell. Use sliders and switches where relevant.
You may want to take a look at http://www.inappsettingskit.com/, we are currently investigating it for the same purpose and it seems to do the job
You can use either a UISlider or a UIPickerView if some of your values have limits.
You can use UISwitch for toggles.
You can also switch the default keyboard for your textfields to be numeric.
Other than that you seem to be on the right track.
Also, sometimes putting a view inside a scrollview makes things seem cooler even if its only one page. The auto bounce on scrollviews is kind of cool.

iPhone, Stylish Buttons?

I am trying to work out (or find) a button that looks half decent for use in my app. In the image below I have two buttons at the bottom, the default button (interfaceBuilder) and one using two png images from the Apple UICatalog.
I am a little shocked that apple did not include something a little more stylish in IB. I assume that my only option is to find/use/make a suitable replacement button image. Before I fire up Photoshop does anyone know of any replacement buttons I might use?
gary
What you can do is use a segmented control with just one segment - you get the shading you want and it's not much harder to use than a standard button.
If you want to try out some button designs, you can draw them in Opacity, which includes a template for iPhone buttons. Opacity can output the button as a stretchable PNG for use in the button or as a UIView / UIButton subclass with all the Quartz drawing calls within it.
I recommend having a look into the Three20 library. It provides a TTButton class that can be customized using TTStyles, and its very easy to create your own styles. In the Three20 example app, there are a lot of styles available already, especially styles for navigation bar buttons. They serve as great examples.

iPhone: add badge to icons internal to my app

I am trying to add badges to the icons in my app. e.g. in the facebook app, in the home page the number of pending requests is shown on the requests icon.
Can someone provide any links/ideas on how to do this?
Thanks,
V
I know this article is a little bit old, but it helps me recently to make a little class to create custom badges. I thought it would be fair to make this class public for everyone. So here it is CustomBadge.
best regard
- Sascha
Lots of ways to do this. You can overlay a UILabel over the icon (which may be a UIView or UIImageView). YOu can put another view on top of the icon, and draw the text right into that view. Or make your icon view be a subclass of UIView, and when you get called to draw, you draw the icon and the number.
Plus, you may want to play with blend modes, shadow, masking, etc., in order to create something that is visually attractive.
I'd probably start with reading more about Quartz, if you haven't already. The rest is just how you wire it all up.
And some other links:
http://scientificninja.com/development/numeric-badges-on-the-iphone
http://th30z.netsons.org/2009/03/qt4-drawing-notification-badges/
alt text http://th30z.netsons.org/wp-content/uploads/qtdrawbadges.png
The Three20 project (its code is part of the Facebook app) has those badges.