ios - Subclass communicate with Root Class -
i trying make dynamic registration form structure. based on providing xml or data, generate dynamic form. here screen shot of class hierarchies.
here, form class base class. depending on provided data, generate how many pages of forms needs created. every page can have 1 table 1 or more groups (actually section view). every group has custom fields , custom fields can contains special textfeild or dropdown field or imagefield.
here generated form screen:

the problem facing is: page.m class contains table view delegate methods , need fire event cf_fields class. example: cfimageview contains imagepickercontroller delegate methods. when image picked library, need expand table view cell height. don't have event access cfimageview class.
the class hierarchies are: "form" contains "page" classes (table logic here) "page" contains "group" classes "group" contains "customfeild" classes "customfeild" contains "fieldview" classes "fieldview" contains "cftextfield" or "cfdropdown" or "cfimageview" classes
i need fire event bottom classes in page class.
do need inherit of classes, or need use delegate or should maintain categories ?
i communicated following way. don't know right way or not!
-(void)pageviewupdate { bool found = false; uiview *currentsuperview = self; while (!found) { if ([[currentsuperview superview] iskindofclass:[customfield class]]) { customfield *customfield = (customfield *)[currentsuperview superview]; customfield.height = custom_field_image_height+custom_field_image_view_cell_height_padding; } if([[currentsuperview superview] iskindofclass:[page class]]) { found = true; page *page = (page *)[currentsuperview superview]; [page updatetableview]; } currentsuperview = [currentsuperview superview]; } } i searching desired superview class access necessary properties.
Comments
Post a Comment