我下面有一个叠加层,每次加载相机预览屏幕时都会出现。我想在叠加层上以编程方式命名为“完成”的圆形rect按钮。我该怎么办?
- (UIView*)CommomOverlay {
UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,430)];
UIImageView *FrameImg = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,430)];
[FrameImg setImage:[UIImage imageNamed:@"newGraphicOverlay.png"]];
FrameImg.userInteractionEnabled = YES;
[view addSubview:FrameImg];
return view;
}
另外,我将在
finishButtonPressed
方法中添加什么以显示名为testviewcontroller
的笔尖的视图? 最佳答案
1.)这是添加到视图中心的蓝色按钮:
UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,430)];
UIImageView *FrameImg = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,430)];
[FrameImg setImage:[UIImage imageNamed:@"newGraphicOverlay.png"]];
FrameImg.userInteractionEnabled = YES;
[view addSubview:FrameImg];
UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 150, 50)];
button.center = view.center;
button.backgroundColor = [UIColor blueColor];
button.layer.cornerRadius = 10.0;
button.titleLabel.text = @"Finished";
[view addSubview:button];
2.)您应该:
在情节提要中附加segue
命名segue标识符
调用performSegueWithIdentifier
(如果您希望在segue之前完成额外的工作,请务必实施prepareForSegue)
关于ios - 如何制作圆角按钮覆盖?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11787600/