Reputation: 63299
Hey I have a view contains multiple UIScrollView produced programmatically which means it's impossible to use the global variable to link these 2. So I am trying to use key-value coding scheme. Below is the code snippet.
UIPageControl *pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(0, 240, 320, 30)];
pageControl.numberOfPages = [holder_items count];
pageControl.currentPage = 0;
[pageControl addTarget:self action:@selector(pageTurn:) forControlEvents:UIControlEventValueChanged];
[cell addSubview:pageControl];
[picScrollView setValue:pageControl forKey:@"pagecontrol"];
[pageControl setValue:picScrollView forKey:@"scrollview"];
But the xcode complains:
setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key pagecontrol.'
Any suggestions?
Upvotes: 1
Views: 133
Reputation: 3529
Just create a custom class for that inherit that class from UISCrollView
and create your veriable inside that class to hold that. And replace UIScrollView with that custom class.
Upvotes: 2