gpt4 book ai didi

ios - 覆盖 UIViewController 的 View 属性

转载 作者:行者123 更新时间:2023-11-28 21:46:52 26 4
gpt4 key购买 nike

我想覆盖我的 MYViewController : UIViewControllersetView: 方法,这样我就不允许某些人设置 view的属性为 nil

-(void)setView:(UIView*)view {
if (view == nil)
//ignore - make no change
else
//default performance
}

我该怎么做?

最佳答案

仅当您需要默认行为时才调用父类(super class)应该可以完成工作:

-(void)setView:(UIView*)view {
if (view == nil) {
//ignore - make no change
}
else {
//default performance
[super setView:view];
}
}

关于ios - 覆盖 UIViewController 的 View 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29814493/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com