IOS 7.0 changes transparent background on table to white

SeanKerrSeanKerr Sean KerrAUMember

Hi There,

On iOS 6, my table view was transparent and looked great. First time running iOS 7, and the background is white.

I have tried making the table backgroundColor, cell color etc etc to UIColor clearColor but have no change. I've tried everything and still no joy.

What else can I try?

Sean

Posts

  • AlexWhiteAlexWhite Alex White GBMember ✭✭

    null the backgroundview

    tableView.BackgroundView = null; tableView.BackgroundColor = (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) ? UIColor.White : UIColor.Black;

    All The Best

    alex

  • SeanKerrSeanKerr Sean Kerr AUMember

    Hi Alex, that didn't work for me. I'm using MTD StyledStringElement. I've tried pretty much everything I can think of to change it.

    Anything else I can try?

  • AlexWhiteAlexWhite Alex White GBMember ✭✭

    in the getcell for the StyledStringElement

    cell.BackgroundColor = UIColor.Clear;
    

    should do what you want, if it does not post up some code with notes.

  • SeanKerrSeanKerr Sean Kerr AUMember

    I tried all of those. I finally had to apply this at the instance level.

    public CustomStyledStringElement (string caption, NSAction tapped) : base (caption,  tapped)
        {
            this.BackgroundColor = UIColor.Clear;
            this.TextColor = UIColor.Clear;
        }
    

    Thanks for your help on this.

    Sean

  • NasserNasser Nasser USMember

    Hi,

    I can't change my background to black, here is my code in Main.cs :

    public override bool FinishedLaunching (UIApplication app, NSDictionary options){ ViewState.LoadData ();

            // Set background image
            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.BlackOpaque;
            UIImage background = UIImage.FromFile (Service.ApplicationMediaPath + "Logo.png");
            this.BackgroundImage = new UIImageView (new RectangleF (this.view.Frame.X, 40, this.view.Frame.Width, this.view.Frame.Height));
            this.BackgroundImage.BackgroundColor = UIColor.FromPatternImage (background);
            this.window.AddSubview (this.BackgroundImage);
    
            // Define tab bar items images
            this.btnGeneral.Image = UIImage.FromFile (Service.MediaPath + "General.png");
            this.btnProgram.Image = UIImage.FromFile (Service.MediaPath + "Program.png");
            this.btnRestaurants.Image = UIImage.FromFile (Service.MediaPath + "Restaurant.png");
            this.btnHotels.Image = UIImage.FromFile (Service.MediaPath + "Hotel.png");
    
            // Define available functionnalities
            var buttons = tabBar.Items.ToList ();
            //buttons.Remove(btnProgram);
            tabBar.Items = buttons.ToArray ();
            tabBar.ItemSelected += OnTabBarItemSelected;
    
            InitViews ();
    
            this.lblTitle.Text = Service.ApplicationName;
            this.lblTitle.Tag = TITLE_TAG;
            this.imgTitle.Image = UIImage.FromFile (Service.ApplicationMediaPath + "Top.png");
            this.btnRefresh.SetBackgroundImage (UIImage.FromFile (Service.MediaPath + "Refresh.png"), UIControlState.Normal);
            this.btnRefresh.Tag = REFRESH_TAG;
            this.btnRefresh.TouchDown += BtnRefreshTouchDown;
            this.btnRefresh.Hidden = true;
            this.view.BringSubviewToFront (this.btnRefresh);
    
            this.window.SendSubviewToBack (this.BackgroundImage);
            this.window.MakeKeyAndVisible ();
    
            PushNotifications.Subscribe ();
            this.DisplayAlert = true;
    
            //if (options != null && options.ContainsKey (UIApplication.LaunchOptionsRemoteNotificationKey)) {
            DisplayNews ();
            //}
    
            Utils.DisplayTabBarItemNotificationBadge (this.btnGeneral);
    
            return true;
        }
    

    I have multiple Controller loaded when we click on the status bar. If it's not clear don't hesitate.

    Thanks

  • gastonmzgastonmz Gaston Martinez USMember

    I have the same problem, any solution?

  • SeanKerrSeanKerr Sean Kerr AUMember

    Hi there, I solved the problem by setting the background properties at the instance level. In my case I was creating custom StringStyledElements.

    Does that help at all.

  • c0lbyc0lby Colby Williams USMember ✭✭

    Try setting the TableView's BackgroundView Property to a new transparent view:

    TableView.BackgroundView = new UIView() { Frame = View.Frame, BackgroundColor = UIColor.Clear };

Sign In or Register to comment.