我有一个 UIImageView 全屏,上面有按钮。这些按钮在按下时应该打开一个带有按钮的较大图像。一个按钮打开站点,另一个按钮关闭图像。我考虑过使用图层来显示图像,但即使按钮有效,也没有任何结果。
- (void)viewDidLoad
{
[super viewDidLoad];
self.bigImageView= [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"SBS_visual_ok.jpg"]];
self.bigImageView.frame = self.view.bounds;
//....
self.buttonInternational =[UIButton buttonWithType:UIButtonTypeRoundedRect];
[self.buttonInternational addTarget:self action:@selector(pressedInternational:) forControlEvents:UIControlEventTouchUpInside];
self.buttonInternational.frame = CGRectMake (100, 100, 100, 100);
//...
[self.view addSubview:self.bigImageView];
[self.bigImageView addSubview:self.buttonInternational];
}
按下按钮 我想用一些按钮拍张照片,但连图像都没有出来。我已经进口了
-(void)pressedInternational:(id)sender{
CALayer *layer =[CALayer layer];
layer.frame = CGRectMake(300, 400, 300, 200);
layer.contents =(id)[UIImage imageNamed:@"International_Security_Service.png"].CGImage;
[[self.bigImageView layer]addSublayer:layer];
NSLog(@"The layer is %@", layer);
//The layer is <CALayer: 0x757ba30>
}
怎么穿上一层纽扣?