我正在尝试通过单击按钮来检查子视图的图像是否隐藏。日志确实显示,但我无法以某种方式获得图像的隐藏状态。
这里出了什么问题?希望你能帮助我!
查看didload:
SubSlide1Hoofdstuk3 *subslide1 = [[SubSlide1Hoofdstuk3 alloc] init];
CGRect frame = self.view.frame;
frame.origin.x = 0;
frame.origin.y = 0;
subslide1.view.frame = frame;
// This works finaly
UIImageView *zwart = subslide1.imageZwart;
[zwart setImage:[UIImage imageNamed:@"imageblack.jpg"]];
[subslide1.b1 addTarget:self action:@selector(switchImageZwart:) forControlEvents:UIControlEventTouchUpInside];
[_scrollView addSubview:subslide1.view];
检查子视图中图像的 IBAction 被隐藏:
-(IBAction)switchImageZwart:(id)sender
{
SubSlide1Hoofdstuk3 *switchactie = [[SubSlide1Hoofdstuk3 alloc] init];
UIImageView *wit = switchactie.imageWit;
UIImageView *zwart = switchactie.imageZwart;
if(zwart.hidden == YES) {
NSLog(@"Image black is hidden!");
} else if(wit.hidden == YES) {
NSLog(@"Image white is hidden!");
} else {
NSLog(@"Can't say... :(");
}
}