Lets create a _contactView in .h file using IBOutlet, and connect it in .xib file.
Connect it to the _contactView.
In .m:
//The following line will create a similar view as _contactView in the XIB;
id copyOfView = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:_contactsView]];
// Repeat the view to generate multiple copies and add to the scroll view.
for (int i =0; i<_contactArray.count; i++) {
UIView* tempView ;//= [[UIView alloc]init];
id copyOfView = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:_contactsView]];
tempView = copyOfView;
tempView.tag = i;
[tempView setFrame:CGRectMake(xOffset, yOffset, width, height)];
yOffset += ySpacing+height;
[_contactScrollView addSubview:tempView];
}
what value has to be given xOffset and yOffset
ReplyDeleteCan you post a Sample on this please...
ReplyDelete