論盡蛋
心で書く

Blog


PPLogger

During the Lunar New Year, published the first draft of PPLogger, which is a logging tool for iOS development.

It provides macros which extended the NSLog functionality, such as adds severity to the log message. It also helps hidding debug message from end users.

It is also published to cocoapods with version 0.1.0. Since it is v0.1.0, it is not recommended to use it on production environment unless you could afford the risk (or you truely trust the code, the code base is small anyway).

Feel free to contribute. You may find the souce code here: https://github.com/peterwongpp/PPLogger.


Pull to refresh table view controller

Finally can pay my full attention to iOS development.

Basically this is a subclass of UITableViewController, which adds the functionality of pulling downward to refresh (or reload).

The following is the usage:

  1. Copy the files into your project:

    • PPPullToRefreshTableViewController.h
    • PPPullToRefreshTableViewController.m
    • pullToRefreshArrow.png
    • pullToRefreshArrow@2x.png
  2. your table view controller should inherit from PPPullToRefreshTableViewController (which is a UITableViewController subclass), instead of the original UITableViewController

    1. in YourTableViewController.h
      1. #import "PPPullToRefreshTableViewController.h"
      2. @interface YourTableViewController : PPPullToRefreshTableViewController
    2. override the following method:
      1. - (void) refreshing
        • you should call didRefresh inside this method in order to hide the refresh header view
    3. you may want to call willRefresh to start refreshing in code (this method by default shows the refresh header view, and calls refreshing automatically)
  3. In your build target's Link Binbary with Libraries section, add the QuartzCore.framework

You may clone the demo project, which is a Master-Detail application together with the PPPullToRefreshTableViewController source code, from here:

git clone git://github.com/peterwongpp/PPPullToRefreshTableViewController.git

The project's repository: PPPullToRefreshTableViewController

Any pull requests, discussions or issues are welcome!