uitableview - IOS: use custom cell in some classes -
when crate custom cell create class uitableviewcell , add nib tablecell; it's clear. want understand how manage situation when should use custom cell in classes use tableview.
for example have view controller called "firstviewcontroller" , inside view controller have tableview, import class of tableview cell , create iboutlet reference
#import "mycell.h" iboutlet mycell *mycell;
in file's owner of mycell class in identity inspector set class of firstviewcontroller, in way can link iboutlet of custom cell easily.
in way can use mycell firstviewcontroller, there way share mycell other classes secondviewcontroller?
thanks
you can create subclass of uitableviewcell, customcell
. create xib file,add uitableviewcell root of xib. change identity of uitableviewcell
customcell
. connect outlets elements of customcell. don't give ownership viewcontroller.
instantiate following code in tableview:cellforrowatindexpath:
in viewcontroller want
customcell *customcell = [[nsbundle mainbundle]loadnibnamed:@"customcell" owner:nil options:nil][0];
Comments
Post a Comment