Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subclasses UITableViewCells don't receive reuse identifier, and are not reused #7

Closed
tbrannam opened this issue Oct 24, 2014 · 4 comments

Comments

@tbrannam
Copy link
Contributor

The ISSViewHierarchyParser treats subclasses of UITableViewCell as a custom view type, and therefore does not call the designated initializer -initWithStyle:reuseIdentifier: -- as a side effect - the UITableView's dequeueReusableCellWithIdentifier: is not able to recycled Subclassed UITableViewCells.

The Sample's PrototypeExampleCell exhibits this behavior.

@tbrannam
Copy link
Contributor Author

One suggestion I could make is to require the XML markup to use the general use tags of tableviewcell, but include a xml attribute to indicate the ObjC classname to use.

Additionally or alternatively it might be useful to allowing the default mapping from the elements to a Concrete class as a base configuration - perhaps this could be contained in options passed to the ISSViewBuilder? Or an external mapping?

For example, a plist containing - such that the custom class will be created by default, and fallback to the built in types?
@{@"tableviewcell" : @"PrototypeExampleCell",
@"tableview": @"MyCustomTableView"}

@tbrannam
Copy link
Contributor Author

Pull request #9 does not address custom class mapping,

@tolo tolo closed this as completed in e0cb328 Oct 31, 2014
@tbrannam
Copy link
Contributor Author

This has been working very well - although since tagToClass in internal to ISSViewHierachyParser, my XML becomes very un-DRY

        <label class="I number"  impl="TTTAttributedLabel"/>
        <label class="II number" impl="TTTAttributedLabel"/>
        <label class="III number"  impl="TTTAttributedLabel"/>
        <label class="IV number" impl="TTTAttributedLabel"/>
        <label class="V number" impl="TTTAttributedLabel"/>

It would be good to allow applications to override the default implementation class at application startup.

@tolo
Copy link
Owner

tolo commented Nov 22, 2014

Added initial support for this, by exposing the method elementNameToViewClass in ISSViewHierarchyParser (see 649fbda).

Note though that it also is possible to specify the implementation class via the XML element name, i.e.:

<TTTAttributedLabel class="I number"/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants