[MacRuby-devel] How do we center label text?

2011-05-26 Thread [email protected]
Couple of quick questions I hope someone can help with.

1. How do we center text in labels?

I have a text label, and it is set to blank (text deleted via interface 
builder) but when the text comes in I'd like it to center, any ideas how to do 
it? I'm setting my label via self.label.stringValue.

I've googled and tried this but it doesn't seem to work: 
self.label.textAlignment = UITextAlignmentCenter

2. Is it possible to add images to the window (via interface builder - this bit 
I can do) but set them to hide and then only show them if I need to via my ruby 
code? Once I make the connection to an image how would I do that?

Sorry to be a pita - hope someone can help.

Cheers.
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] How do we center label text?

2011-05-26 Thread Shannon Love
UITextAlignmentCenter is for iOS. Anything starting with "UI" is iOS specific. 
You want NSTextAlignment.
On May 26, 2011, at 8:34 PM, [email protected] wrote:

> Couple of quick questions I hope someone can help with.
> 
> 1. How do we center text in labels?
> 
> I have a text label, and it is set to blank (text deleted via interface 
> builder) but when the text comes in I'd like it to center, any ideas how to 
> do it? I'm setting my label via self.label.stringValue.
> 
> I've googled and tried this but it doesn't seem to work: 
> self.label.textAlignment = UITextAlignmentCenter
> 
> 2. Is it possible to add images to the window (via interface builder - this 
> bit I can do) but set them to hide and then only show them if I need to via 
> my ruby code? Once I make the connection to an image how would I do that?
> 
> Sorry to be a pita - hope someone can help.
> 
> Cheers.
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel