ios - Inheritance of view -
i'm new ios , i'm trying understand how platform works, excuse me if create dumb questions.
my question based on problem nowadays in post: inheritance on view controller objective c
so far, understand can inherit controllers, can inherit view? think reply no. if case, best way solve next problem?
i have card matching game. now, have expand game have similar card game different deck , rules.
therefore, want reuse code , have main controller , 2 inherited controllers redefine creation of deck. need have 2 different views because 2 games have different number of cards. so, best way this? have re-create controls 1 view , modify what's needed?
you can inherit view fine. create subclass of uiview
when add together new file , import subclass.
regarding question, sense best way approach have subclass of uiviewcontroller
called cardscontroller
has deck property , can manage display , alter of cards based on set of rules defined you. then, subclass view controller farther each of 2 games, since both create utilize of cards.
ios objective-c inheritance
No comments:
Post a Comment