English 中文(简体)
TU-Controller和UITableViewConller共有逻辑
原标题:UIViewController and UITableViewController shared logic

页: 1 BaseViewController, 继承>, 并继承> 可调频密码的类别。 这两个类别都有相同的共同逻辑(即轮换处理、助手方法等)。 如今,这部法典只是重复的。 我认为,我只是提出一种观点,即“ControllerHelper”阶级,把它当作一种公共财产,但我很想知道,是否还有任何更可取的解决办法。

最佳回答

如果你不需要分摊的批量/财产,你可以写给国际笔记长的延长。

问题回答

I d 创立一个共同类别,如<代码>BaseViewController,有两个初步编制者:

initWithList: (for table view) and initWithSomething: for brief UIViewController enuff. 这些初步设计者将分别装载轴心(其中一台配有<>编码>可检索<>>>编码>,作为主要观点,另一种是作为简单的<编码>查询/编码>。

You d have the same methods in every instance. And it would only need to implement UITableViewDelegate and UITableViewDataSource protocols.





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签