posts - 186,  comments - 17,  views - 35万
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

修改不了颜色了 结果发现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];

                

            }

            

        }

        

    }

    

}

posted on   ZOYOO  阅读(632)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
点击右上角即可分享
微信分享提示