1
我正在開發一個使用非常簡單的界面並在後端進行數據庫處理的iphone應用程序。我也啓用ARC OPTION。 我viewDidLoad方法如下:iphone應用程序開發的內存問題
@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做:
- (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? 我正在使用ARC選項。
此外,當我在模擬器中運行帶有配置文件選項的應用程序以進行內存分配和泄漏時,它有時會顯示內存級別低警告和內存級別正常。這是什麼原因?
我需要在dealloc方法中調用[super dealloc]嗎? –
如果您使用的是ARC,則不需要。 –
'aggresive release'是什麼意思?我如何在ARC中發佈?請解釋? 另外,所有的對象應該設置爲ARC在零?請查看代碼片段並告訴我對象名稱。 –