c# - Stack overflow in unmanaged IP - Xamarion iOS -
i'm making small app ios in xamarin in visual studio 2015 keep getting error when run application:
critical: stack overflow in unmanaged: ip: 0x2e8785, fault addr: 0xbff07ffc
right background i'm doing. programmatically adding uicontrols main viewcontroller working fine code on place. decided reorganize mess new class display uicontrols. when did , ran application started getting error.
can me out or point me in right direction? if need see code let me know , i'll add in.
thanks.
* updated *
drawmenu.cs
namespace drawingcomponents { class drawmenu { userinterfacecontrols uicontrols; const int x_btn = 100; const int y_btn = 100; const int padding = 5; float xmainportrait; // main views width float ymainportrait; // main views height float xsub; // subviews width inrelation mainviews dimensions. float ysub; // subviews height inrelation mainview demensions. float widthmainportrait = 205; float heightmainportrait = 310; public void portraitnormal(uiview view) { xmainportrait = ((float)view.bounds.size.width - widthmainportrait) / 2; ymainportrait = ((float)view.bounds.size.height - heightmainportrait) / 2; // draw frame var mainframe = new cgrect(xmainportrait, ymainportrait, widthmainportrait, heightmainportrait); uicontrols.mainview = new uiview(mainframe); // x , y coordinants of mainview xsub = (float)uicontrols.mainview.bounds.x; ysub = (float)uicontrols.mainview.bounds.y; // center of mainview , last button float xcenter = ((float)uicontrols.mainview.bounds.size.width / 2) - (x_btn / 2); float ycenter = (y_btn * 2) + (padding * 2); // draw each component. uicontrols.btn_myschedule.frame = new cgrect(xsub, ysub, x_btn, y_btn); uicontrols.btn_mycareer.frame = new cgrect(xsub + x_btn + padding, ysub, x_btn, y_btn); uicontrols.btn_mysocial.frame = new cgrect(xsub, ysub + y_btn + padding, x_btn, y_btn); uicontrols.btn_feedback.frame = new cgrect(xsub + x_btn + padding, ysub + y_btn + padding, x_btn, y_btn); uicontrols.btn_mydetails.frame = new cgrect(xcenter, ycenter, x_btn, y_btn); uicontrols.mainview.autoresizingmask = uiviewautoresizing.flexiblemargins; uicontrols.btn_myschedule.autoresizingmask = uiviewautoresizing.flexiblewidth; uicontrols.btn_mycareer.autoresizingmask = uiviewautoresizing.flexiblewidth; uicontrols.btn_mysocial.autoresizingmask = uiviewautoresizing.flexiblewidth; uicontrols.btn_feedback.autoresizingmask = uiviewautoresizing.flexiblewidth; uicontrols.btn_mydetails.autoresizingmask = uiviewautoresizing.flexiblewidth; view.add(uicontrols.mainview); uicontrols.mainview.addsubview(uicontrols.btn_myschedule); uicontrols.mainview.addsubview(uicontrols.btn_mycareer); uicontrols.mainview.addsubview(uicontrols.btn_mysocial); uicontrols.mainview.addsubview(uicontrols.btn_feedback); uicontrols.mainview.addsubview(uicontrols.btn_mydetails); } } }
mainviewcontroller.cs
namespace drawingcomponents { struct userinterfacecontrols { public uiview mainview; public uibutton btn_myschedule; public uibutton btn_mycareer; public uibutton btn_mysocial; public uibutton btn_feedback; public uibutton btn_mydetails; } class mainviewcontroller : uiviewcontroller { userinterfacecontrols uicontrols; drawmenu menu = new drawmenu(); public override void viewdidload() { base.viewdidload(); // instantiate menu buttons uicontrols.btn_myschedule = new uibutton(); uicontrols.btn_mycareer = new uibutton(); uicontrols.btn_mysocial = new uibutton(); uicontrols.btn_feedback = new uibutton(); uicontrols.btn_mydetails = new uibutton(); // set image of each button uicontrols.btn_myschedule.setimage(uiimage.fromfile("images/myschedule.png"), uicontrolstate.normal); uicontrols.btn_mycareer.setimage(uiimage.fromfile("images/mycareer.png"), uicontrolstate.normal); uicontrols.btn_mysocial.setimage(uiimage.fromfile("images/mysocial.png"), uicontrolstate.normal); uicontrols.btn_feedback.setimage(uiimage.fromfile("images/feedback.png"), uicontrolstate.normal); uicontrols.btn_mydetails.setimage(uiimage.fromfile("images/mydetails.png"), uicontrolstate.normal); positioncontrols(interfaceorientation); } public override bool shouldautorotatetointerfaceorientation(uiinterfaceorientation tointerfaceorientation) { switch(tointerfaceorientation) { case uiinterfaceorientation.landscapeleft: case uiinterfaceorientation.landscaperight: case uiinterfaceorientation.portrait: case uiinterfaceorientation.portraitupsidedown: default: return true; } } public override void willanimaterotation(uiinterfaceorientation tointerfaceorientation, double duration) { base.willanimaterotation(tointerfaceorientation, duration); positioncontrols(tointerfaceorientation); } protected void positioncontrols(uiinterfaceorientation tointerfaceorientation) { switch(tointerfaceorientation) { case uiinterfaceorientation.landscapeleft: case uiinterfaceorientation.landscaperight: if (view.bounds.size.width > 480) { // add code here } else { // add code here } break; case uiinterfaceorientation.portrait: case uiinterfaceorientation.portraitupsidedown: if (view.bounds.width > 414) { // add code here } else { menu.portraitnormal(view); } break; } } } }
Comments
Post a Comment