ios - How to create CollectionView global object Which can be accessible from any controller? -
how create collectionview global object can accessible controller? want create uicollectionview can accessible view controller, , display collectionview on same controller called.
you can use singleton:
@interface collectionviewsingleton : uicollectionview + (id)shared; @end @implementation collectionviewsingleton + (id)shared { static collectionviewsingleton *shared = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ shared = [[self alloc] init]; }); return shared; } @end
Comments
Post a Comment