iOS:覆盖子类中父类(super class)的setter属性

标签 ios objective-c inheritance subclass superclass

我需要在我的子类中覆盖父类(super class)的setter

父类(super class):

公共(public)接口(interface):

 @property (weak, nonatomic) UIView *mediaView;

实现:

 - (void)setMediaView:(UIView *)mediaView
{
 // some code
}

子类:

实现:

 - (void)setMediaView:(UIView *)mediaView
{
 // some code
 _mediaView = mediaView; --- ERROR: Use of undeclared identifier '_mediaView'
 // some code 
}

我该如何解决?我需要直接设置这个属性

最佳答案

用子类中的代码解决

 @synthesize mediaView = _mediaView;

关于iOS:覆盖子类中父类(super class)的setter属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31059416/

相关文章:

ios - UIViewControllerAnimatedTransitioning UINavigationController 推送和弹出

java - 如何调用基类方法?

c# - 在 C# 中继承事件处理程序

c++ - 将 const char 传递给不兼容的类型 double

iphone - 如何弄清楚模拟器中的 `call stack` 含义?

ios - 自定义 View 单元格的属性始终设置为 nil (UITableView)

ios - 在多个地方显示相同图像的正确 Firebase 设计是什么

iphone - 未知类型名称 'TransportViewController'

ios - 适用于 iOS 的 AdMob 错误 : Llibrary not found for -lGoogleAdMobAds

java - 使用继承,为什么我的测试类中没有定义 goPee()?