How to make UILabel a child of another UILabel in Interface Builder?

I need to make a half of a sentence red and the other half blue, so I placed two different UILabels in Interface Builder and changed their colors accordingly using the GUI. On the Objective-C side, sometimes I need to hide and reveal the sentence.

self.redHalf.hidden = YES;
self.blueHalf.hidden = YES;

self.redHalf.hidden = NO;
self.blueHalf.hidden = NO;

This is not modular code. I'd rather just make one call to hide or reveal the whole sentence. So I tried to make one half the child of the other half by dragging one atop the other in Interface Builder, but nothing happened.


You cannot make subviews in a UILabel in IB. (You can do it in code though.)

Just drag out a generic UIView in IB and make both UILabels subviews of the generic UIView. Then set the generic UIView's hidden property to hide or show both labels.

Need Your Help

Showing ProgressDialog during UI Thread operation in Android

android multithreading android-asynctask progressdialog

As I've asken on another question HERE it seems that the PackageManager.getInstalledPackages() doesn't play nice with Threading. As CommonsWare stated HERE:

Single parameters to new() must be a HASH ref data


I have a perl script and it works on perl version 5.8.8 but 5.14 got that error: Odd number of elements in anonymous hash at