ios - How to change font size and color of UIAlertAction in UIAlertController -
https://www.safaribooksonline.com/library/view/ios-8-swift/9781491908969/images/ispc_0113.png
in image above how change font size , color of "done", "some other action"? , how change font size , color of "title", , "message"?
thank you.
this stack overflow post seems work fine. post found here.
uialertcontroller *alertvc = [uialertcontroller alertcontrollerwithtitle:@"dont care goes here, since we're change below" message:@"" preferredstyle:uialertcontrollerstyleactionsheet]; nsmutableattributedstring *hogan = [[nsmutableattributedstring alloc] initwithstring:@"presenting great... hulk hogan!"]; [hogan addattribute:nsfontattributename value:[uifont systemfontofsize:50.0] range:nsmakerange(24, 11)]; [alertvc setvalue:hogan forkey:@"attributedtitle"]; uialertaction *button = [uialertaction actionwithtitle:@"label text" style:uialertactionstyledefault handler:^(uialertaction *action){ //add code make happen once tapped }]; uiimage *accessoryimage = [uiimage imagenamed:@"someimage"]; [button setvalue:accessoryimage forkey:@"image"];
to change color of text following, adding before line setting [alertvc setvalue:hogan forkey:@"attributedtitle"];
[hogan addattribute:nsforegroundcolorattributename value:[uicolor redcolor] range:nsmakerange(0,35)];
Comments
Post a Comment