カスタムにカスタムを配置しようとしてUIButton
いますUIView
が、UIButton
が表示されません。を印刷しようとするとUISubViews
、そこにオブジェクトがUIView
表示されます。UIButton
以下は、カスタムにボタンを配置するために作成しているコードの一部です。UIView
- (id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor blackColor];
self.headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
self.headerLabel.backgroundColor = [UIColor clearColor];
self.headerLabel.textColor = [UIColor whiteColor];
self.headerLabel.font = [UIFont systemFontOfSize:kApplicationHeaderTextFont];
[self addSubview:self.headerLabel];
self.actionButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.actionButton.frame = CGRectZero;
[self addSubview:self.actionButton];
}
return self;
}
- (void)drawRect:(CGRect)iTotalRect{
if (self.actionButtonImage) {
self.actionButton.frame = CGRectMake(self.frame.size.width - self.actionButtonImage.size.width - 10.0, self.frame.size.height / 2 - self.actionButtonImage.size.height / 2, self.actionButtonImage.size.width, self.actionButtonImage.size.height);
[self.actionButton setImage:self.actionButtonImage forState:UIControlEventTouchUpInside];
}
誰かが私が間違っていることを知っていますか?