I am populating a UIScrollView from data collected via XML. I'd like the user to press a "Next" button on the view to be able to see more data relative to the data in the displayed view. When they click the button, a new view is presented, with the relevant data.
The problem I'm having is, whenever I try to pass the information from the initial element into the new view, all I get is the LAST element in the XML set. So, I need to be able to save the element set at the point of the button select, and pass that to the new view, however, I can't seem to figure it out.
Is what I'm trying to do possible?
The pertinent function is:
The problem I'm having is, whenever I try to pass the information from the initial element into the new view, all I get is the LAST element in the XML set. So, I need to be able to save the element set at the point of the button select, and pass that to the new view, however, I can't seem to figure it out.
Is what I'm trying to do possible?
The pertinent function is:
Code:
-(void)layoutScrollView
{
CGRect workingFrame;
workingFrame.origin.x = 0;
workingFrame.origin.y = 0;
workingFrame.size.width = 768;
workingFrame.size.height = 1024;
NoelsMyRealtorXMLView *myView;
for(NoelsMyRealtorXMLElement *element in [self xmlElementObjects])
{
NSString *trimmedString = [[element title1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"NoelsMyRealtorXMLView" owner:nil options:nil];
for(id currentObject in topLevelObjects)
{
if([currentObject isKindOfClass:[NoelsMyRealtorXMLView class]])
{
myView = (NoelsMyRealtorXMLView *)currentObject;
}
}
UIImage *t_Image_View = [[UIImage alloc]init];
t_Image_View = [element imageView];
tempImageView = t_Image_View;
self.tempImageView = element.imageView;
[[myView v_imageView] setImage:[element imageView]];
[[myView v_title1] setText: [element title1]];
[[myView v_photodate1] setText: [element photodate1]];
[[myView v_mls] setText: [element MLS]];
[myView setFrame:workingFrame];
UIButton * btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(301, 636, 165, 30);
[btn setTitle:@"See More Info" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(flipView:) forControlEvents:UIControlEventTouchUpInside];
[btn setTag:1];
btn.alpha = .5;
currentMLS = [[NSMutableString alloc] initWithString:[element MLS]];
[myView addSubview:btn];
[scrollView addSubview:myView];
workingFrame.origin.x = workingFrame.origin.x + 768;
}
workingFrame.size.width = workingFrame.origin.x;
[scrollView setContentSize:workingFrame.size];
workingFrame.origin.x = 0;
workingFrame.origin.y = 0;
workingFrame.size.width = 768;
workingFrame.size.height = 1024;
[scrollView setFrame:workingFrame];
}