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

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -