2011-12-27 229 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