修改不了颜色了 结果发现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 2017-09-28 10:25  ZOYOO  阅读(623)  评论(0编辑  收藏  举报