Open dejo opened 15 years ago
I think you're doing something wrong. I have this code working just fine. There may be some other issue.
flowView = [[AFOpenFlowView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; flowView.dataSource = self; flowView.viewDelegate = self; [flowView setNumberOfImages:12]; [self.view addSubview:flowView];
initWithFrame:, after taking care of its super class duties, calls [self setUpInitialState];, right? And the first thing setUpInitialState does is set up the default image via self.defaultImage = [self.dataSource defaultImage]. But, at this point, self.dataSource has not yet been set and is nil.
I worked around this by adding the following to AFOpenFlowView:
- (void)setDataSource:(id<AFOpenFlowViewDataSource>)theDataSource {
dataSource = theDataSource;
self.defaultImage = [self.dataSource defaultImage];
}
I am trying to add an OpenFlow view in code rather than through IB. But setUpInitialState expects self.datasource to already be set which is impossible when using the standard: AFOpenFlowView *openFlowView = [[AFOpenFlowView alloc] initWithFrame:CGRectMake(...)];
I can't set openFlowView.datasource = self; until after this line.