ios8 - iOS 8 Custom emoji keyboard Memory issue - Swift - -
i added emoji view keyboard . can use on simulator when run on iphone 6 crashes because of memory can't handle emojis ( think ) . instruments didn't me . here code
// init emojis let peopleemojipath : string = nsbundle.mainbundle().pathforresource("people", oftype: "plist")! let peopleemoji :nsarray = nsarray(contentsoffile: peopleemojipath)! let natureemojipath : string = nsbundle.mainbundle().pathforresource("nature", oftype: "plist")! let natureemoji :nsarray = nsarray(contentsoffile: natureemojipath)! let foodemojipath : string = nsbundle.mainbundle().pathforresource("food&drink", oftype: "plist")! let foodemoji :nsarray = nsarray(contentsoffile: foodemojipath)! let celebrationemojipath : string = nsbundle.mainbundle().pathforresource("celebration", oftype: "plist")! let celebrationemoji :nsarray = nsarray(contentsoffile: celebrationemojipath)! let activityemojipath : string = nsbundle.mainbundle().pathforresource("activity", oftype: "plist")! let activityemoji :nsarray = nsarray(contentsoffile: activityemojipath)! let travelemojipath : string = nsbundle.mainbundle().pathforresource("travel&places", oftype: "plist")! let travelemoji :nsarray = nsarray(contentsoffile: travelemojipath)! let objectsemojipath : string = nsbundle.mainbundle().pathforresource("objects&symbols", oftype: "plist")! let objectsemoji :nsarray = nsarray(contentsoffile: objectsemojipath)! // init emojis let bigemojiarray : array<nsarray> = [peopleemoji,natureemoji,foodemoji,celebrationemoji,activityemoji,travelemoji,objectsemoji] var emojibutton : uibutton! var ypos : cgfloat = 1 var xpos : cgfloat = 0 var emojiscrollview : uiscrollview = uiscrollview(frame: cgrectmake(0, 0, self.frame.size.width, self.frame.size.height)) emojiscrollview.showshorizontalscrollindicator = false emojiarray in bigemojiarray{ emojistring in emojiarray{ emojibutton = uibutton.buttonwithtype(.custom) as! uibutton emojibutton.frame = cgrectmake(xpos, ypos, self.frame.size.height / 5, 40) emojibutton.settitle(emojistring as? string, forstate: .normal) emojibutton.addtarget(self, action: "iamemojibuttonpressed:", forcontrolevents: .touchupinside) emojibutton.titlelabel?.font = uifont(name: "apple color emoji", size: 31) if ypos >= self.frame.size.height - self.frame.size.height / 5 - 1{ xpos += 44 ypos = 1 } else{ ypos += 43 } emojiscrollview.addsubview(emojibutton) } } emojiscrollview.contentsize = cgsizemake(xpos + 50, self.frame.size.height - self.frame.size.height / 5 - 1) self.addsubview(emojiscrollview) } and here image of allocation in instruments . can see big jump here . happens when press button brings emoji view super view

i need know problem , solve
Comments
Post a Comment