youknowone / UI7Kit

Backport flat-style UIKit from iOS7 to iOS5+
Other
1.67k stars 199 forks source link

UINavigationBar titleTextAttributes ignored in modally presented view controllers when set via UIAppearance proxy #120

Open postmechanical opened 10 years ago

postmechanical commented 10 years ago
    // Assume [UI7Kit patchIfNeeded] called in main.m before NSApplicationMain
    [[UINavigationBar appearance] setTitleTextAttributes:@{ UITextAttributeTextColor : [UIColor blueColor] }];

    // self.navigationController's view controllers all have correct text color.

    UIViewController *vc = [[UIViewController alloc] init];
    vc.title = @"Test";
    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:vc];
    [self.navigationController presentViewController:navController animated:YES completion:nil];

    // navController's view controllers do not have correct text color.
postmechanical commented 10 years ago

Add a search bar to the modally presented view controller and you get another issue. The search bar doesn't patch properly.

ios simulator screen shot oct 15 2013 3 41 37 pm

postmechanical commented 10 years ago

Another issue. If you do the following:

        [UI7Kit excludeClassNamesFromAutopatch:@[@"UI7NavigationBar"]];
        [UI7Kit patchIfNeeded];

Then an initial navigation view controller does not have its navigation bar patched, but any subsequently modally presented navigation view controller does have its navigation bar patched.

postmechanical commented 10 years ago

This may be an issue only in a modal view controller presented on an existing modal view controller.

postmechanical commented 10 years ago

This appears to be an issue with custom UINavigationController subclasses only.