【问题标题】:UITableViewController FilesUITableViewController 文件
【发布时间】:2012-11-03 12:11:49
【问题描述】:

完全按照教程,我创建了扩展 UITableViewController 的文件。问题是他的 uitableviewcontroller.m 文件充满了预先编写的代码(如 viewDidLoad),而我的完全空白!我们的 uitableviewcontroller.h 文件都有

的代码
#import <UIKit/UIKit.h>

@interface ChemTable : UITableViewController
@property (strong,nonatomic)NSMutableArray *Chemarray;


@end

【问题讨论】:

    标签: objective-c uitableview


    【解决方案1】:

    出于学习目的,自动生成的方法使用最少(即使您将其删除也完全可以)。即使您可以在没有它们的情况下创建应用程序......“viewDidLoad”是加载视图时运行的一种非常必要的方法,但是当您使用真正的应用程序时,您肯定会使用一些自动生成的方法。

    额外 -->我想你也应该看到这个: ViewDidLoad - 当您创建类并从 xib 加载时调用。非常适合初始设置和一次性工作

    ViewWillAppear - Called right before your view appears, good for hiding/showing fields or any operations that you want to happen every time before the view is visible. Because you might be going back and forth between views, this will be called every time your view is about to appear on the screen
    
    ViewDidAppear - Called after the view appears - great place to start an animations or the loading of external data from an API.
    
    ViewWill/DidDisappear - Same idea as the WillAppear.
    
    ViewDidUnload/Dispose - Available to you, but usually not necessary in Monotouch. In objective-c, this is where you do your cleanup and release of stuff, but this is handled automatically so not much you really need to do here.
    

    【讨论】:

      猜你喜欢
      • 2012-01-30
      • 2012-07-13
      • 2017-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多