1

i'm having a subclassed NSView. i created an object as below:

CustomView * ClockT = [[CustomView alloc]init];  
ClockT.tZone = @"Canada/Yukon";  
[HolderView addSubview:ClockT];

but the view does not shown. how can i fix that?

Muruganandham K
  • 5,271
  • 5
  • 34
  • 62

1 Answers1

1

Use [[CustomView alloc] initWithFrame:frame] passing a meaningful frame or assign a frame after creation.

Basically there are only three reasons why a view may be invisible:

  1. Wrong frame: zero frame size or origin is out of the visible coordinates;
  2. Does not have a visible superview, i.e. not added as a subview;
  3. isHidden property set to YES.
Davyd Geyl
  • 4,578
  • 1
  • 28
  • 35