Answer the question
In order to leave comments, you need to log in
Passing data View Controller - View, strange behavior?
I have a View Controller ( PagedFlowView ) which contains a custom view ( Collapse click ).
Essentially, my View Controller has a method
- (UIView *)flowView:(PagedFlowView *)flowView cellForPageAtIndex:(NSInteger)index;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
- (UIView *)flowView:(PagedFlowView *)flowView cellForPageAtIndex:(NSInteger)index{
mainDetailV = (MainDetailView *)[flowView dequeueReusableCell];
if (!mainDetailV) {//creating pages flow one by one
mainDetailV = [[[NSBundle mainBundle] loadNibNamed:@"MainDetailView" owner:self options:nil] lastObject];
mainDetailV.layer.masksToBounds = YES;
}
mainDetailV.shouldDraw = YES;
mainDetailV.someData = [NSString stringWithFormat:@"%i",index];//transfer index to custom view
return mainDetailV;
}
- (void)drawRect:(CGRect)rect
; , yes, I understand that this is not very good for performance, but at this stage I'm not interested in it. - (void)drawRect:(CGRect)rect{
[self initMehod];
}
-(void) initMehod{
myCollapseClick.CollapseClickDelegate = self;
myCollapseClick.alpha = 0.8;
[myCollapseClick reloadCollapseClick];
}
-(NSString *)titleForCollapseClickAtIndex:(int)index
;, in order to set the page index (used earlier):-(NSString *)titleForCollapseClickAtIndex:(int)index {
return someData;
}
- (UIView *)flowView:(PagedFlowView *)flowView cellForPageAtIndex:(NSInteger)index{
mainDetailV = (MainDetailView *)[flowView dequeueReusableCell];
if (!mainDetailV) {//creating pages flow one by one
mainDetailV = [[[NSBundle mainBundle] loadNibNamed:@"MainDetailView" owner:self options:nil] lastObject];
mainDetailV.layer.masksToBounds = YES;
}
mainDetailV.shouldDraw = YES;
mainDetailV.someData = [NSString stringWithFormat:@"%i",index];//transfer index to custom view
NSLog(@"%li",index); // HERE
return mainDetailV;
}
Answer the question
In order to leave comments, you need to log in
When I try to console the index in the following method
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question