改变uilable uibutton等的字体颜色、大小。

-(void)changeButtonFont:(UIView *)aView withColorFlag:(int) i

{

    

    if ([aView isKindOfClass:[UILabel class]]) {

        UILabel *lb = (UILabel    *)aView;

        if (i==1) {

            [lb setTextColor:[UIColor whiteColor]];

        }else {

          [lb setFont:[UIFontsystemFontOfSize:13]];  

           [lb setTextColor:[UIColor blackColor]];

         }

        

        [lb setTextAlignment:UITextAlignmentCenter];

        [lb setFont:[UIFontsystemFontOfSize:13]];

        //            [lb setBackgroundColor:[UIColor whiteColor]];

    }

    NSArray *na = [aView subviews];

    NSEnumerator *ne = [na objectEnumerator];

    UIView *subView;

    while (subView = [ne nextObject]) {

        [selfchangeButtonFont:subView withColorFlag:i];

    }

    

    

原文地址:https://www.cnblogs.com/sgdkg/p/2715511.html