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

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -