I had the same problem. In fact, layoutSubviews is no longer called for UILabel on iOS8, since Apple does not expect anyone to use it as a supervisor.
I use ReactiveCocoaLayout , so this can be done by subscribing to rcl_frameSignal or rcl_boundsSignal.
-(void)awakeFromNib { [ self.rcl_boundsSignal subscribeNext: ^( NSValue* boundsValue ) { //layout changed } ]; }
Or you can use a simple KVO to know when the frame was changed:
-(void)dealloc { [ self removeObserver: self forKeyPath: @"layer.bounds" ]; } -(void)observeValueForKeyPath:( NSString* )keyPath ofObject:( id )object change:( NSDictionary* )change context:( void* )context { if ( [ keyPath isEqualToString: @"layer.bounds" ] ) {
Igor Palaguta
source share