基于我的实施的具体问题是:
问题:
背景:
答案 0 :(得分:1)
用户拖动鼠标(或手指?)的子视图可被视为某种控件,因此在这种情况下您只需使用目标/操作。或者可能是一个代表团。这样你就可以保持这个子视图和viewcontroller松散耦合,这也可以让你在其他地方重用同一个类(子视图的实例)。所以,如果是授权:
定义协议:
@protocol ColorPickerViewDelegate
将属性@property(nonatomic, assign) id<ColorPickerViewDelegate> didUpdateDelegate;
添加到颜色选择UIView子类。
让你的viewcontroller采用上述协议,并在viewcontroller的实现部分中定义该协议的方法。
创建颜色选择子视图时,将viewcontroller设置为该子视图的didUpdateDelegate。
在颜色选择视图触摸处理逻辑中的适当时间调用didUpdateDelegate:[didUpdateDelegate colorPickerView:self didUpdateWithColor:someNewColor];
希望这就是你想要的
答案 1 :(得分:0)
我猜iOS控制库中没有任何ColorPickerController?是自定义控制器吗?请注明,以便相应地回答。