2016-10-18 10 views
3

私はChameleonをプロジェクトに追加しました。ほとんどの場合、うまく機能します。プロジェクトのテーマを設定するときに、UITableViewCellアクセサリに配置されているバックグラウンドを見つけたときに遭遇した1つの問題です。UITableViewAccessoryの背景色を削除

は、ここに私のアクセサリが有効になってChameleonFrameworkテーマに次のようになります。

enter image description here

私の希望アクセサリーの色が背景なしと青です。カメレオンはこれらを逆転させるようです。

また、デバッグビュー階層を開き、何が起こっているのかを確認しました。私はこの問題を「見る」ことができますが、私は戻ってUIColor.whiteにそれを変更するためにアクセサリビューの背景で取得する方法を見つけ出すことができない、また私はUIColor.blue

enter image description here

にチェックマークを変更する方法を見つけ出すことができます

私はcellForRowAtIndexPathで次のコマンドを使用して、付属品の色合いをいじくり回すことを試みてきました:

cell.tintColor = UIColor.blue 

私もaccessoryViewの背景を変更してみました:

cell.accessoryView!.tintColor = UIColor.blue 
cell.accessoryView?.backgroundColor = UIColor.white 

私もtableViewの色合いを変更してみました:

tableView.tintColor = UIColor.blue 

他のアイデア私はこれを大幅に高く評価されている変更については行くだろうか。

+0

cell.accessoryViewを使用してみてください?.backgroundColor = UIColor.clearColor() – PrafulD

+0

感謝。私はすでにそれを試みた。 – Adrian

答えて

0

明らかに、これはカメレオンが現在取り組んでいるバグです。

デバッグビュー階層で掘り下げて、チェックマークがUIButtonとして描かれていることがわかりました。 MyViewControllerで変更するのではなく、UITableViewCellに含まれているAppDelegateでUIButtonクラスの外観を変更することを選択しました。

私はAppDelegateから次のコマンドを呼び出すことによって、私の問題を解決することができました:

UIButton.appearance(whenContainedInInstancesOf: [UITableViewCell.classForCoder() as! UIAppearanceContainer.Type]).backgroundColor = UIColor.clear 
    UIButton.appearance(whenContainedInInstancesOf: [UITableViewCell.classForCoder() as! UIAppearanceContainer.Type]).tintColor = FlatBlue() 
1

XamarinChameleon-RCI 2.1.0.2を使用する場合はUITableViewCellAccessory.DetailDisclosureButtonを使用しているとき、私は同じ問題を抱えていました。エイドリアンの答えと同様に

UITableViewCell cell = tableView.DequeueReusableCell("A"); 
if (cell == null) 
{ 
     cell = new UITableViewCell(UITableViewCellStyle.Subtitle, "A"); 
     cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton; 
} 

が、C#修正がAppDelegateクラスで次のようだったと。

public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) 
{ 
    // Override point for customization after application launch. 
    // If not required for your application you can safely delete this method 

    UIColor secondaryColor = ChameleonColor.FlatWatermelon; 
    Chameleon.SetGlobalTheme(ChameleonColor.FlatMint, secondaryColor, ContentStyle.Contrast); 

    UIButton.UIButtonAppearance buttonAppearance = UIButton.AppearanceWhenContainedIn(new Type[] { typeof(UITableViewCell) }); 
    buttonAppearance.BackgroundColor = UIColor.Clear; 
    buttonAppearance.TintColor = secondaryColor; 

    return (true); 
} 
関連する問題