This is a migrated thread and some comments may be shown as answers.

Problems changing background color of drawer

1 Answer 343 Views
SideDrawer
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
James
Top achievements
Rank 1
James asked on 02 Jun 2015, 04:33 AM

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

 

 

 

 

 

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 03 Jun 2015, 08:43 AM
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
Tags
SideDrawer
Asked by
James
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or