我正在开发一个 iphone 应用程序,它使用非常简单的界面并在后端进行数据库处理。我也在启用 ARC OPTION。我的 viewDidLoad 方法如下:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
/*********needed to implement scroll view********/
svScroll.frame = CGRectMake(0, 0, 320, 460);
svScroll.contentSize = CGSizeMake(320, 800);
/*********************************************/
//[DataHelper openDbCompany];
NSString *date=[DataHelper getFinYr];
[btDate setTitle:[DataHelper dateSqliteToNormal:date] forState:UIControlStateNormal];
arrayUnitsMeasure=[[NSMutableArray alloc]initWithArray:[DataHelper getUnitsOfMeasure]];
//[DataHelper closeDbCompany];
tfValue.keyboardType=UIKeyboardTypeDecimalPad;
tfQuantity.keyboardType=UIKeyboardTypeDecimalPad;
tfCostUnit.keyboardType=UIKeyboardTypeDecimalPad;
//catching the notification for text field value change.
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(textFieldChanged:) name:UITextFieldTextDidChangeNotification object:tfQuantity];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(textFieldChanged:) name:UITextFieldTextDidChangeNotification object:tfCostUnit];
}
我的 .h 文件包含定义如下的 IBOutlets:
@interface
Create_Inventory_Item:UIViewController<Date_Picker_Protocol,Picker_View_Protocol,UITextFieldDelegate>
{
IBOutlet UIScrollView *svScroll;
IBOutlet UITextField *tfItemName;
IBOutlet UILabel *lbUnitsOfMeasure;
IBOutlet UIButton *btSelectUnitsMeasure;
IBOutlet UIButton *btDate;
IBOutlet UINavigationBar *btBack;
IBOutlet UITextField *tfQuantity;
IBOutlet UITextField *tfCostUnit;
IBOutlet UITextField *tfValue;
IBOutlet UIButton *btCreate;
NSMutableArray *arrayUnitsMeasure;
UIButton *btKeyboardDone;
UIView *accessoryView;
UITextField *txtActiveField;
UIButton *btMinus;
Picker_View *callPickerView;
Date_Picker *callDatePicker;
}
@property(nonatomic,retain) UIButton *btMinus;
@property(nonatomic,retain)UITextField *txtActiveField;
@property(nonatomic,retain) UIButton *btKeyboardDone;
@property(nonatomic,retain)UIView *accessoryView;
@property(nonatomic,retain) IBOutlet UINavigationBar *btBack;
@property(nonatomic,retain)IBOutlet UIScrollView *svScroll;
@property(nonatomic,retain)IBOutlet UITextField *tfItemName;
@property(nonatomic,retain)IBOutlet UILabel *lbUnitsOfMeasure;
@property(nonatomic,retain)IBOutlet UIButton *btSelectUnitsMeasure;
@property(nonatomic,retain) IBOutlet UIButton *btDate;
@property(nonatomic,retain) IBOutlet UITextField *tfQuantity;
@property(nonatomic,retain) IBOutlet UITextField *tfCostUnit;
@property(nonatomic,retain)IBOutlet UITextField *tfValue;
@property(nonatomic,retain) IBOutlet UIButton *btCreate;
-(IBAction)btSelectUnitsMeasure:(id)sender;
-(IBAction)btDate:(id)sender;
-(IBAction)btCreate:(id)sender;
-(IBAction) hideKeyboard:(id)sender;
-(IBAction)showAlerView:(NSString *)message;
-(IBAction)btBack:(id)sender;
请告诉我在dealloc和viewDidUnloadMethod中我需要做什么?我正在使用 ARC 选项。
此外,当我在模拟器中使用配置文件选项运行应用程序以进行内存分配和泄漏时,它有时会显示 MEMORY LEVEL LOW WARNING 和 MEMORY LEVEL NORMAL。这是什么原因?