MyStream
MyStream

Reputation: 2553

dynamic button text iphone

If you want to make a multilingual button on a native iPhone app, where it can be one language by default, but based on your settings, show different text on the same button, how would you go about it?

Is it also possible to style (e.g. with text-shadows and custom fonts) the text on the button?

I'm not an iOS developer, but I'm attempting to provide designs for an iOS developer and don't understand the limitations (yet) when going from CSS3 to iOS UI elements.

So far, iOS development appears to be like creating image-maps where none of the CSS logic is applicable from web development and almost all UI elements appear to need all states as flattened images. I thought the controls were more dynamic but haven't found the right terminology for results from google to be very forthcoming on the topic.

Upvotes: 0

Views: 104

Answers (1)

Paresh Navadiya
Paresh Navadiya

Reputation: 38249

U can use NSLocalizedString for multilingual text on button.

Configuring Button Title

  titleLabel  property
  reversesTitleShadowWhenHighlighted  property
– setTitle:forState:
– setTitleColor:forState:
– setTitleShadowColor:forState:
– titleColorForState:
– titleForState:
– titleShadowColorForState:

Also set Custom font like this:

yourButton.titleLabel.font = [UIFont fontWithName:@"Courier" size:22.0];

if u want to add gradient to button then u will have to use CALayer like this:

yourButton.layer = //any modification in button's layer here

For more refer UIButton class reference

Upvotes: 1

Related Questions