Ios 如何在QuickDialog中将UIImageView添加到Qsection?
我有一张图片(UIImageView)和一个按钮(UIButton) 在这个视图中,我使用QuickDialogController,因为它在这个视图中有许多QuickDialog元素 我想在该视图的部分(QSection)中添加图片(UIImageView)和按钮(UIButton) 如何添加它 这是我的示例代码Ios 如何在QuickDialog中将UIImageView添加到Qsection?,ios,objective-c,uiimageview,uibutton,quickdialog,Ios,Objective C,Uiimageview,Uibutton,Quickdialog,我有一张图片(UIImageView)和一个按钮(UIButton) 在这个视图中,我使用QuickDialogController,因为它在这个视图中有许多QuickDialog元素 我想在该视图的部分(QSection)中添加图片(UIImageView)和按钮(UIButton) 如何添加它 这是我的示例代码 // test Add Image -(void) addImageView { image = [[UIImageView alloc] initWithFrame:CGR
// test Add Image
-(void) addImageView
{
image = [[UIImageView alloc] initWithFrame:CGRectMake(35, 60, 250, 250)];
[image setImage:[UIImage imageNamed:@"image.jpg"]];
[image setContentMode:UIViewContentModeScaleAspectFit];
[self.view addSubview:image];
}
// test Add Button
-(void) addRotateButton
{
button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(125, 350, 70, 40);
button.backgroundColor = [UIColor lightGrayColor];
[button setTitle:@"Rotate" forState:UIControlStateNormal];
[button addTarget:self action:@selector(onRotateButtonClicked:) forControlEvents:UIControlEventTouchDown];
[self.view addSubview:button];
}
谢谢。我认为有两种方法可以做到这一点。最简单的方法是将带有按钮的视图和imageview添加到节标题中
# s is a Section, code is ruby motion
s.headerView = UIView.alloc.initWithFrame [[0,0],[300,1]]
image_view = UIImageView.alloc.initWithFrame CGRectMake(0, 0, 100, 100)
s.headerView.addSubview image_view
s.headerView.addSubview button
如果您想将其添加到该部分的其他位置。我认为您需要创建一个继承表单QElement的新类。我还没有这样做