Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use properly when integrating OpenFlow strictly with code (no IB) #2

Open
dejo opened this issue Dec 3, 2009 · 3 comments
Open

Comments

@dejo
Copy link

dejo commented Dec 3, 2009

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.

@JaredCrawford
Copy link

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];

@dejo
Copy link
Author

dejo commented Dec 22, 2009

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.

@jamis
Copy link

jamis commented Oct 8, 2010

I worked around this by adding the following to AFOpenFlowView:

- (void)setDataSource:(id<AFOpenFlowViewDataSource>)theDataSource {
  dataSource = theDataSource;
  self.defaultImage = [self.dataSource defaultImage];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants