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

Shannon Love techzen at me.com
Thu May 26 18:45:58 PDT 2011

UITextAlignmentCenter is for iOS. Anything starting with "UI" is iOS specific. You want NSTextAlignment.
On May 26, 2011, at 8:34 PM, azzzz at gmx.net 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
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

More information about the MacRuby-devel mailing list