Reputation: 32227
@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: ( ... )
I'm trying to copy itemsContainer
to itemsContainerDefaults
but I'm getting the error in the log. Why isn't this working?
Upvotes: 0
Views: 175
Reputation: 1814
In order to call -copy on an object, it must conform to NSCopying. UIScrollView does not.
I think what you want to achieve has a better approach. But I'm not certain what you want to achieve. You want to make a visual copy of the scrollview? Why not just make a new scrollview that uses the same datasource as the first scrollview?
Upvotes: 1