0

H

@property (nonatomic, strong) IBOutlet UIScrollView *itemsContainer;
@property (nonatomic, strong) UIScrollView *itemsContainerDefaults;

- (void)awakeFromNib
{
    self.itemsContainerDefaults = [self.itemsContainer copy]; // breaks here
}

安慰

2013-02-27 19:09:07.585 Test App[2038:907] -[UIScrollView copyWithZone:]: unrecognized selector sent to instance 0x1ddcde60
2013-02-27 19:09:07.586 Test App[2038:907] Uncaught exception: -[UIScrollView copyWithZone:]: unrecognized selector sent to instance 0x1ddcde60
2013-02-27 19:09:07.601 Test App[2038:907] Stack trace: ( ... )

我正在尝试复制itemsContainer到,itemsContainerDefaults但我在日志中收到错误。为什么这不起作用?

4

1 回答 1

1

为了在对象上调用 -copy,它必须符合 NSCopying。UIScrollView 没有。

我认为您想要实现的目标有更好的方法。但我不确定你想要实现什么。您想制作滚动视图的视觉副本吗?为什么不创建一个使用与第一个滚动视图相同的数据源的新滚动视图?

于 2013-02-28T00:19:18.980 回答