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

Can't scroll backwards in Week ViewMode

1 Answer 40 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sal
Top achievements
Rank 1
Sal asked on 27 Oct 2015, 07:42 PM

I have a tableView that uses a TKCalendar as the headerView and when the screen is rotated the Calendar switches from a Month View to Week View. The issue I'm having is that in the Week Mode I can scroll forward all I want, but can't scroll back to any date before the current date, but when I rotate the device back to switch into Month mode I can navigate forwards and backwards without any issues. Don't know what code to show so here's a few snippets. 

 Here's the setup of the calendar in viewDidLoad

self.calendarView.autoresizingMask = [.FlexibleHeight, .FlexibleWidth]
self.calendarView.dataSource = self
self.calendarView.delegate = self
self.calendarView.allowPinchZoom = false
self.calendarView.selectionMode = TKCalendarSelectionMode.Single
self.calendarView.viewMode = calendarViewMode
self.updateCalendarPresenter()
//set the minimum and maximum date components
let dateComponents = NSDateComponents()
dateComponents.year = -5
self.calendarMinDate = NSCalendar.currentCalendar().dateByAddingComponents(dateComponents, toDate: NSDate(), options: [])!
dateComponents.year = 5
self.calendarMaxDate = NSCalendar.currentCalendar().dateByAddingComponents(dateComponents, toDate: NSDate(), options: [])!
self.calendarView.minDate = self.calendarMinDate
self.calendarView.maxDate = self.calendarMaxDate

 

 This is what I have in the rotate interface function

override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation) {
        //landscape mode should switch to week mode
        self.calendarView.viewMode = TKCalendarViewMode.Month
        if UIDevice.currentDevice().orientation.isLandscape {
            self.calendarView.viewMode = TKCalendarViewMode.Week
        }
        self.updateCalendarPresenter()
        //navigate to the current selected date as well
        self.calendarView.navigateToDate(self.selectedDate, animated: false)
        //make sure the table layout is updated
        self.mainTable.setNeedsLayout()
        self.mainTable.layoutIfNeeded()
    }

 

This is the updatePresenter that is called when the device is rotated as well

func updateCalendarPresenter() {
        var presenter = TKCalendarMonthPresenter()
        if self.calendarView.viewMode == TKCalendarViewMode.Week {
            presenter = self.calendarView.presenter as! TKCalendarWeekPresenter
        }
            //the month presenter needs an additional item added
        else {
            presenter = self.calendarView.presenter as! TKCalendarMonthPresenter
            presenter.equalWeekNumber = false
        }
        //hide the title view
        presenter.titleHidden = true
        //change the background color of the calendar
        presenter.style.backgroundColor = UIColor(hexString: ColorCodes.calendarBackground)
        //update case of cell
        presenter.style.dayNameTextEffect = TKCalendarTextEffect.Uppercase
        //let the header stay as a sticky row
        presenter.headerIsSticky = true
        //update presenter
        presenter.update(true)
    }

1 Answer, 1 is accepted

Sort by
0
Yoanna
Telerik team
answered on 28 Oct 2015, 01:17 PM
Hello, Sal.

Thank you for contacting the iOS team.

I tested your scenario and it seem like this is an issue in our latest version that has been released. 
We thank you for pointing our attention to this issue. I have updated your Telerik points accordingly.
I logged the issue in the Telerik feedback portal. It will be fixed in our upcoming release.
You can check its status, vote or comment here.

Should you have any questions do not hesitate to contact us.

Regards,
Yoanna
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
Calendar
Asked by
Sal
Top achievements
Rank 1
Answers by
Yoanna
Telerik team
Share this question
or