mobile - Xamarin IOS: Change tint color in share window -
i using code sharing in xamarin ios:
public void share(string title, string content) { if (uiapplication.sharedapplication.keywindow == null || uiapplication.sharedapplication.keywindow.rootviewcontroller == null) return; if (string.isnullorempty(title) || string.isnullorempty(content)) return; var rootcontroller = uiapplication.sharedapplication.keywindow.rootviewcontroller; var imagetoshare = uiimage.frombundle("icon_120.png"); var itemstoshare = new nsobject[] { new nsstring(content), imagetoshare }; var sharestatuscontroller = new uiactivityviewcontroller(itemstoshare, null) { title = title }; //sharestatuscontroller.navigationcontroller.navigationbar.tintcolor = uicolor.black; //rootcontroller.navigationcontroller.navigationbar.tintcolor = uicolor.black; //sharestatuscontroller.navigationbar.tintcolor = uicolor.fromrgb(0, 122, 255); rootcontroller.presentviewcontroller(sharestatuscontroller, true, null); mvx.resolve<ianalyticsservice>().logevent("share button clicked."); }
when choose mail , redirected here http://take.ms/3ke4f. color of cancel , send buttons white (in navigationbar). how can change color of text of button?
i found article cannot set text color of send , cancel buttons in mail composer when presented uiactivityviewcontroller in ios7. dont know howto apply using xamarin.
thanks help.
try out:
public void share(string title, string content) { if (uiapplication.sharedapplication.keywindow == null || uiapplication.sharedapplication.keywindow.rootviewcontroller == null) return; if (string.isnullorempty(title) || string.isnullorempty(content)) return; //share barbutton tint uibarbuttonitem.appearancewhencontainedin (new [] {typeof(uinavigationbar)}).tintcolor = uicolor.cyan; var rootcontroller = uiapplication.sharedapplication.keywindow.rootviewcontroller; var imagetoshare = uiimage.frombundle("icon_120.png"); var itemstoshare = new nsobject[] { new nsstring(content), imagetoshare }; var sharestatuscontroller = new uiactivityviewcontroller(itemstoshare, null) { title = title }; sharestatuscontroller.completionhandler += (nsstring arg1, bool arg2) => { // set old theme theme uibarbuttonitem.appearancewhencontainedin (new [] {typeof(uinavigationbar)}).tintcolor = uicolor.white; }; rootcontroller.presentviewcontroller(sharestatuscontroller, true, null); mvx.resolve<ianalyticsservice>().logevent("share button clicked."); }
you set the button tint before present controller set in completion handler.
Comments
Post a Comment