ios - How do you add a UICollectionViewController to a UIScrollview within a UIViewController? -
i trying use starting point learn collection view: creating uicollectionview programmatically
i have viewdidload has uiscrollview created so:
uiscrollview *scrollview = [[uiscrollview alloc] initwithframe:cgrectmake(0.0, 64.0,
screenwidth, screenheight)];
how add in uicollectionviewcontroller following below doesn't work:
acollectionviewcontrollerr *vc = [[acollectionviewcontroller alloc] init]; [self.view addsubview:vc];
do need uiscrollview scroll down or uicollectionview have functionality already?
uicollectionview
inherits uiscrollview
, don't need add uiscrollview
. add uicollectionview
uiviewcontroller
directly.
if use uicollectionviewcontroller
don't require uiviewcontroller
.
see documentation of uicollectionview
Comments
Post a Comment