iphone - how to change the arrow direction of UIMenuController just before shown in an UIWebView -


i trying change arrow direction when appears not block top bar set application. here code used change direction:

uimenucontroller *menucontroller = [uimenucontroller sharedmenucontroller]; [menucontroller setarrowdirection:uimenucontrollerarrowup]; 

and here result, say, pretty stressful:enter image description here

it appears same issue on iphone well.

can this? thanks

after days of researching, find way change arrow direction of menu controller in webview. first, please in view controller's viewdidload method.

[[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(menucontrollerwillshow:) name:uimenucontrollerwillshowmenunotification object:nil]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(menucontrollerwillhide:) name:uimenucontrollerwillhidemenunotification object:nil]; 

then, add these 2 functions, arrow direction pointing up, in case menubar appear below text. (same way, can change uimenucontrollerarrowup; other direction if want menubar appear in other position)

-(void)menucontrollerwillshow:(nsnotification *)notification{     //remove show notification prevent     // "menucontrollerwillshow" function called multiple times     [[nsnotificationcenter defaultcenter]removeobserver:self name:uimenucontrollerwillshowmenunotification object:nil];      //hide original menu view     uimenucontroller* menucontroller = [uimenucontroller sharedmenucontroller];     cgpoint origin = menucontroller.menuframe.origin;     cgsize size = menucontroller.menuframe.size;     cgrect menuframe;     menuframe.origin = origin;     menuframe.size = size;     [menucontroller setmenuvisible:no animated:no];      //modify target rect , show again prevent glitchy appearance     menucontroller.arrowdirection = uimenucontrollerarrowup;     [menucontroller settargetrect:menuframe inview:self.view];     [menucontroller setmenuvisible:yes animated:yes];  }  -(void)menucontrollerwillhide:(nsnotification *)notification{     //re-register menucontrollerwillshow     [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(menucontrollerwillshow:) name:uimenucontrollerwillshowmenunotification object:nil]; } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -