ios - This is about album and memory -
i'm using swift, , called once album, systematic approach, , allowed dismiss normal way (perhaps less other way), after call complete systems approach, memory rise 20m, wrote simple example, found still case, wrote immediate window in appdelegate
. swift rootviewcontroller
switch inside, still can not eliminate 20m memory. because called photo album directly 20m, many times i'll call album now, not in demo, need solve 20m problem.
the code:
class viewcontroller: uiviewcontroller, uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate { override func viewdidload() { super.viewdidload() self.view.backgroundcolor = uicolor.whitecolor() var bu = uibutton() bu.frame = cgrectmake(80, 80, 80, 80) bu.backgroundcolor = uicolor.redcolor() bu.addtarget(self, action: "hh", forcontrolevents: .touchupinside) self.view.addsubview(bu) } func hh() { let imagepicker = uiimagepickercontroller() imagepicker.delegate = self imagepicker.allowsediting = true imagepicker.sourcetype = .photolibrary presentviewcontroller(imagepicker, animated: true, completion: nil) } func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingimage image: uiimage, editinginfo: [string : anyobject]?) { picker.dismissviewcontrolleranimated(true, completion: nil) var tt = tviewcontroller() self.presentviewcontroller(tt, animated: true, completion: nil) } func imagepickercontrollerdidcancel(picker: uiimagepickercontroller){ picker.dismissviewcontrolleranimated(true, completion: nil) } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } }
Comments
Post a Comment