2011-12-27 225 views
2

我有两个UIViews,让我称他们为ABAB容器而且每一个是使用界面生成器创建的。加载笔尖查看到另一个笔尖视图

我需要使用Interface Builder我B视图添加到A,这样的形象:

A UIView created using interface builder

B UIView created using interface builder

的问题是,在视图加载,但它是空的,当我调试我看到每个组件都被创建。

BUIView类的定义是:

BH(ISMSliderCustomizable.h)

@interface ISMSliderCustomizable : UIView { 

    IBOutlet UIView *view; 
    IBOutlet UISlider *slider; 
    IBOutlet UILabel *minLabel; 
    IBOutlet UILabel *maxLabel; 
    IBOutlet UIImageView *tooltip; 
    IBOutlet UILabel *sliderValue; 
} 

@property (nonatomic, retain) IBOutlet UIView *view; 
@property (nonatomic) float min; 
@property (nonatomic) float max; 
@property (nonatomic) float initialValue; 

@end 

BM(ISMSliderCustomizable.m)

- (id)initWithFrame:(CGRect)frame 
{ 
    self = [super initWithFrame:frame]; 
    if (self) 
    { 
     [[NSBundle mainBundle] loadNibNamed:@"ISMSliderCustomizable" owner:self options:nil]; 
     [self addSubview:self.view]; 
    } 
    return self; 
} 

- (void)awakeFromNib { 
    [super awakeFromNib]; 

    [[NSBundle mainBundle] loadNibNamed:@"ISMSliderCustomizable" owner:self options:nil]; 
    [self addSubview:self.view]; 
} 

我需要一个UIView添加到另一个UIView其中每个UIView都是用IB创建的。

回答

1

我认为这个问题是在UIView的是b.xib分辨率320x480 但视图B在a.xib不 所以它不是空的,它只是超出范围

+0

我决定创建通过代码的子视图,我不想再用IB来浪费我的时间。谢谢。 – Nicopuri 2011-12-29 13:11:14