Problems changing background color of drawer

2 posts, 0 answers
  1. James
    James avatar
    14 posts
    Member since:
    Jan 2012

    Posted 01 Jun 2015 Link to this post

    Hello,

    I am following your examples and there is an apparent problem. I am attempting to configure my sidedrawer here.

     

    class DrawerContentController: UIViewController, TKSideDrawerDelegate {


        var sideDrawerView: TKSideDrawerView? = nil
        
        override func viewDidLoad() {
            super.viewDidLoad()


            // Do any additional setup after loading the view.
           
            
            self.view.backgroundColor = UIColor.whiteColor()
            
            sideDrawerView = TKSideDrawerView(frame: self.view.bounds)
            self.view.addSubview(sideDrawerView!)
            
            
            
            let navBar = UINavigationBar(frame: CGRectMake(0, 0, self.view.frame.size.width, 64))
            let navItem = UINavigationItem(title: "Getting Started")
            let showSideDrawerButton = UIBarButtonItem(title: "Show", style: UIBarButtonItemStyle.Plain, target: self, action: "showSideDrawer")
            navItem.leftBarButtonItem = showSideDrawerButton
            navBar.items = [navItem]
            sideDrawerView!.mainView.addSubview(navBar)
           
            let sideDrawer = sideDrawerView!.sideDrawer
            sideDrawer.title = "Navigation Menu"
              sideDrawer.fill = TKSolidFill(color: UIColor(red: 28 / 255.0, green: 250/255.0, blue: 241/255.0, alpha:1.5))
            sideDrawer.delegate = self
            sideDrawer.style.headerHeight = 80
            
          
            
         
            let sectionPrimary = sideDrawerView!.sideDrawer.addSectionWithTitle("Primary")
        
            sectionPrimary.addItemWithTitle("Social")
            sectionPrimary.addItemWithTitle("Promotions")
            
            let sectionLabels = sideDrawerView!.sideDrawer.addSectionWithTitle("Labels")
            sectionLabels.addItemWithTitle("Social")
            sectionLabels.addItemWithTitle("Promotions")
            sectionLabels.addItemWithTitle("Sent Mail")
            sectionLabels.addItemWithTitle("Drafts")


            
            
            
            
        }


        override func didReceiveMemoryWarning() {
            super.didReceiveMemoryWarning()
            // Dispose of any resources that can be recreated.
        }
        
        func showSideDrawer() {
            self.sideDrawerView!.sideDrawer.show()
        }
        
        func sideDrawer(sideDrawer: TKSideDrawer!, updateVisualsForItemAtIndexPath indexPath: NSIndexPath!) {
            let section = sideDrawer.sections()[indexPath.section] as! TKSideDrawerSection
            let item = section.items()[indexPath.item] as! TKSideDrawerItem
            item.style.contentInsets = UIEdgeInset

     

    Of particular focus to me is the background color. With this code I am still getting the default background with no changes. I am using this object as content for my drawer. I am using this object in my app delegate like so:

     

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
            // Override point for customization after application launch.
            
            let contentController = DrawerContentController()
            
            let sideDrawerController = TKSideDrawerController(content: contentController)
        
            
            self.window?.rootViewController = sideDrawerController
            
            return true
        }

     

    I just want to be able to change the background color of the drawer.

    Please assist. Thank you

     

     

     

     

     

     

     

     

     

     

     

  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 03 Jun 2015 Link to this post

    Hello James,

    Thank you for contacting us.

    When using SlideInOnTop transition type (which is by default) TKSideDrawer applies blur effect on its background. That is why you can't change the background in this scenario. You should set the blurType to None in order to be able to set the fill property:
    sideDrawer.style.blurType = TKSideDrawerBlurType.None;

    I hope this helps. Feel free to write back if you have further questions.

    Regards,
    Jack
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top