runtime查找 UIAlertAction 的key 及 UIActionSheet 设置字体颜色
修改不了颜色了 结果发现kvo 的key 不对 哎 直接上代码 设置正确的属性找到对应的key 还以为iOS 11改变了方法
unsigned int count;
Ivar *ivars = class_copyIvarList([UIAlertAction class], &count);
for (int i = 0; i < count; i++) {
Ivar ivar = ivars[i];
const char * cName = ivar_getName(ivar);
NSString *ocName = [NSString stringWithUTF8String:cName];
NSLog(@"%@",ocName);
}
free(ivars);
function:-[ReplayTextView takePhotoClick] line:192 content:_title
function:-[ReplayTextView takePhotoClick] line:192 content:_titleTextAlignment
function:-[ReplayTextView takePhotoClick] line:192 content:_enabled
function:-[ReplayTextView takePhotoClick] line:192 content:_checked
function:-[ReplayTextView takePhotoClick] line:192 content:_isPreferred
function:-[ReplayTextView takePhotoClick] line:192 content:_imageTintColor
function:-[ReplayTextView takePhotoClick] line:192 content:_titleTextColor
function:-[ReplayTextView takePhotoClick] line:192 content:_style
function:-[ReplayTextView takePhotoClick] line:192 content:_handler
function:-[ReplayTextView takePhotoClick] line:192 content:_simpleHandler
function:-[ReplayTextView takePhotoClick] line:192 content:_image
function:-[ReplayTextView takePhotoClick] line:192 content:_shouldDismissHandler
function:-[ReplayTextView takePhotoClick] line:192 content:__descriptiveText
function:-[ReplayTextView takePhotoClick] line:192 content:_contentViewController
function:-[ReplayTextView takePhotoClick] line:192 content:_keyCommandInput
function:-[ReplayTextView takePhotoClick] line:192 content:_keyCommandModifierFlags
function:-[ReplayTextView takePhotoClick] line:192 content:__representer
function:-[ReplayTextView takePhotoClick] line:192 content:__interfaceActionRepresentation
function:-[ReplayTextView takePhotoClick] line:192 content:__alertController
UIActionSheet 设置字体颜色 因为runtime没找到相应的key 直接去设置 但是通过 _alertController 还是能再次设置 喜迎十九大,人才辈出
- (void)takePhotoClick{
NSLog(@"z选择照片");
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:STR(@"cancel") destructiveButtonTitle:nil otherButtonTitles:STR(@"checeImgAlbum"),@"Camera ", nil];
// [sheet setValue:[UIColor colorWithHexCode:@"FD6501"] forKey:@"_titleTextColor"];
[sheet showInView:self.view];
unsigned int count;
Ivar *ivars = class_copyIvarList([UIActionSheet class], &count);
for (int i = 0; i < count; i++) {
Ivar ivar = ivars[i];
const char * cName = ivar_getName(ivar);
NSString *ocName = [NSString stringWithUTF8String:cName];
NSLog(@"%@",ocName);
}
free(ivars);
// [sheet setTintColor:[UIColor orangeColor]];
}
-(void)willPresentActionSheet:(UIActionSheet *)actionSheet
{
SEL selector = NSSelectorFromString(@"_alertController");
if ([actionSheet respondsToSelector:selector])//ios8
{
UIAlertController *alertController = [actionSheet valueForKey:@"_alertController"];
if ([alertController isKindOfClass:[UIAlertController class]])
{
alertController.view.tintColor = [UIColor colorWithHexCode:@"FD6501"];
}
}
else//ios7
{
for( UIView * subView in actionSheet.subviews )
{
if( [subView isKindOfClass:[UIButton class]] )
{
UIButton * btn = (UIButton*)subView;
[btn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
}
}
}
}
runtime查找 UIAlertAction 的key 及 UIActionSheet 设置字体颜色的更多相关文章
- Latex中如何设置字体颜色(3种方式)
Latex中如何设置字体颜色(三种方式) 1.直接使用定义好的颜色 \usepackage{color} \textcolor{red/blue/green/black/white/cyan/ma ...
- 如何在HTML中设置字体颜色,你知道这几种方式吗?
color设置字体颜色 在color设置字体颜色之前,我们首先了解color在CSS中有几种取值方式,一共有4种方式,若有不全还请在评论区告知谢谢,4种方式如下: 十六进制.十进制. 英文单词.十六进 ...
- python设置图片背景和设置字体颜色大小
# -*- coding: utf-8 -*- """ Created on Wed Dec 11 22:37:30 2019 @author: Dell "& ...
- 关于UIAlertAction如何修改sheet上的字体颜色
相信很多程序员都会遇到需求是这样的: 但是你发现无论怎么设置cancel和Destructive都无法让红色字体移动到下面取消按钮上: 其实之前一直用错,用了ios9之前的UIActionSheet这 ...
- C# 控制台程序(命令行程序)设置字体颜色,窗口宽高,光标行数
控制台程序(命令行程序)设置窗口宽度高度,如下代码: Console.WriteLine(Console.WindowHeight); Console.WriteLine(Console.Buffer ...
- C# 控制台程序设置字体颜色
这几天做了个程序,程序本身很简单.大体功能是输入查询条件,从数据库里取出结果计算并显示.但是用户的要求是使用控制台(console)来实现功能.由于功能简单,程序很快就做完了,在面向用户演示程序时,突 ...
- android 设置字体颜色、EditText自己主动输入转换成大写字母的多种方式
在TextView上面设置某一个字的字体颜色为指定颜色时,能够通过java类SpannableString类和Html语言来实现. (一)SpannableString类方式 private void ...
- wpf设置字体颜色渐变和字体阴影
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment=&quo ...
- c++控制台 设置字体颜色
一种方法是直接在程序上方栏杆点右键,然后属性处设置 优点是设置后一劳永逸,不需要像后面方法那样要自己把设置写入程序代码内 缺点是,一旦设置了就不能再改变了,程序从头到尾都是那种设置. 第二种方法是使用 ...
随机推荐
- 4.scala中的类
版权申明:转载请注明出处.文章来源:http://bigdataer.net/?p=269 排版乱?请移步原文获得更好的阅读体验 1.针对不同字段生成的方法 字段生成的方法备注 var/val nam ...
- 上采样和PixelShuffle(转)
有些地方还没看懂, mark一下 文章来源: https://blog.csdn.net/g11d111/article/details/82855946 去年曾经使用过FCN(全卷积神经网络)及其派 ...
- pandas的常用函数
1.DataFrame的常用函数: (1)np.abs(frame) 绝对值, (2)apply function, lambda f= lambda x: x.max()-x.min(),frame ...
- UML中的组合、聚合、关联、继承、实现、依赖
转自:http://justsee.iteye.com/blog/808799 UML定义的关系主要有六种:依赖.类属.关联.实现.聚合和组合. 继承 指的是一个类(称为子类.子接口)继承另外的一个类 ...
- ContentControl和ContentPresenter的应用
1:wpf中,所有的内容控件都继承自“ContentControl” ,所以我们可以直接应用“ContentControl”自定义我们“需要的”内容控件. 2:ContentControl具有Cont ...
- C++(二十六) — 构造函数、析构函数、对象数组、复制构造函数
1.构造函数 (1)每个类都要定义它自己的构造函数和析构函数,是类的成员函数. 特点:名称与类名相同:没有返回值:一定是共有函数,可以直接访问类内所有成员函数:可以带默认形参,可以重载: class ...
- docker下rabbitMQ高可用集群部署
第一步:docker 安装: mac 下安装命令: brew cask install docker 安装完之后查看版本 docker --version 第二步:开始集群搭建: 采用bijukunj ...
- Ubuntu相关命令
此贴包含自己搭建网站以及自学Ubuntu遇到的相关命令,方便以后查看,故相关帖子整理记录在此! 用户切换 当前用户切换到root用户,只需要执行sudo su即可. root用户切回user用户,只需 ...
- nginx默认配置
user nobody; worker_processes 2; worker_cpu_affinity 000000001000 000000010000; worker_rlimit_nofile ...
- jmap和jstack使用
http://blog.csdn.net/sinat_29581293/article/details/70214436