1

InAppSettingKitビューコントローラの背景色を変更しようとしています。

cellForRowAtIndexPathをサブクラス化してオーバーライドしてみました:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
    cell.textLabel.backgroundColor = [UIColor redColor];
    cell.detailTextLabel.backgroundColor = [UIColor redColor];
    return cell;
}

UIColorのカテゴリを作成してみました。

+ (UIColor *)groupTableViewBackgroundColor {
    return [UIColor redColor];
}

何を試しても、シミュレーターは正しい(期待される)動作を示しますが、私のiPhoneはデフォルトのグループテーブルの背景を示しています。

これを修正する方法について何か考えはありますか?おそらくそれは、アプリデリゲートでInAppSettingsViewControllerのインスタンスを作成する方法です...?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    IASKAppSettingsViewController *iaskvc = [[IASKAppSettingsViewController alloc] init];
    i = [UIImage imageNamed:@"20-gear-2.png"];
    [[iaskvc tabBarItem] setImage:i];
    [[iaskvc tabBarItem] setTitle:@"Settings"];

    // Create the Toolbar
    UITabBarController *tabBarController = [[UITabBarController alloc] init];
    NSArray *viewControllers = [NSArray arrayWithObjects:iaskvc, nil];
    [tabBarController setViewControllers:viewControllers];

    [[self window] setRootViewController:tabBarController];
    [self.window makeKeyAndVisible];
    return YES;
}

XCode:バージョン4.5.2(4G2008a)iOS展開ターゲット:iPhone上の5.1 iOS:6.0.1(10A523)

シミュレーター-期待される iPhone-カスタマイズが機能しない

4

1 に答える 1

2

さて、SOで何か他のことを読んだ後、答えを見つけました。それで、もう少し考えさせられました。

サブクラス化されたIASKAppSettingsViewControllerを次のように初期化します。

MyAppSettingsViewController *iaskvc = [[MyAppSettingsViewController alloc] initWithNibName:@"MyAppSettingsViewController" bundle:nil];

自分のxibファイル(以前は持っていなかった)を追加することで、必要なものをすべてカスタマイズでき、iPhoneでも問題なく動作しました。

于 2012-12-08T19:09:59.797 に答える