Can you access application delegate from within a UITableViewDataSource function?

后端 未结 4 1972
余生分开走
余生分开走 2021-01-01 09:42

I\'m trying to figure out the SQLite functionality for the iPhone, and I\'m having some problems reading my database file from an overridden UITableViewDataSource function.

4条回答
  •  一向
    一向 (楼主)
    2021-01-01 10:00

    Roger is correct, but I personally find it extremely confusing to mix dot syntax and bracket syntax in the same statement.

    If this confuses you as well, the equivalent syntax, using only bracket notation, is:

    [[UIApplication sharedApplication] delegate];
    

    and yes, you may need to cast the result to be your application delegate class, rather than the generic UIApplicationDelegate class, or you will get a number of compiler warnings, most likely.

提交回复
热议问题