将笔尖视图加载到另一个笔尖视图中
我有两个 UIViews
,让我将它们称为 A
和 B
。 A
是 B
的容器,每一个都是使用 Interface Builder 创建的。
我需要使用界面生成器将我的 B
视图添加到 A
中,如下图所示:
问题是视图已加载但它是空的,当我调试它时,我看到每个组件都已创建。
B
UIView
类定义为:
Bh (ISMSliderCustomizing.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 (ISMSliderCustomizing.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创建的。
I have two UIViews
, let me called them as A
and B
. A
is the container of B
and each one is created using Interface Builder.
I need to add my B
view into A
using interface builder, like this image:
The problem is that the view is loaded but it's empty, when I debugged it I saw that every component is created.
The B
UIView
class definition is:
B.h (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
B.m (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];
}
I need to add a UIView
into another UIView
which every UIView
is created with IB.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为问题是 b.xib 中的 UIView 是 320x480
但 a.xib 中的视图 B 不是
所以它不是空的,只是超出了范围
I think the problem is UIView in b.xib is 320x480
but View B in a.xib is not
so it's not empty,it just out of range